This repository has been archived by the owner on Sep 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from TextControl/proofing
Proofing
- Loading branch information
Showing
30 changed files
with
610 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
/** | ||
* Available Dictionaries Resource File | ||
* | ||
* This script downloads all the available dictionaries from the Reporting Cloud Web API and writes them to the file: | ||
* | ||
* resource/available-dictionaries.php | ||
* | ||
* The package maintainer should execute this script, whenever new dictionaries are added to the backend. | ||
* | ||
*/ | ||
|
||
include_once 'bootstrap.php'; | ||
|
||
use TxTextControl\ReportingCloud\Console\Helper; | ||
use TxTextControl\ReportingCloud\Exception\RuntimeException; | ||
use TxTextControl\ReportingCloud\ReportingCloud; | ||
|
||
$outputFilename = realpath(__DIR__ . '/../resource/available-dictionaries.php'); | ||
|
||
// --------------------------------------------------------------------------------------------------------------------- | ||
|
||
$reportingCloud = new ReportingCloud([ | ||
'username' => Helper::username(), | ||
'password' => Helper::password(), | ||
]); | ||
|
||
$availableDictionaries = $reportingCloud->getAvailableDictionaries(); | ||
|
||
sort($availableDictionaries); | ||
|
||
if (0 === count($availableDictionaries)) { | ||
throw new RuntimeException('Cannot download the available dictionaries from the Reporting Cloud Web API.'); | ||
} | ||
|
||
// --------------------------------------------------------------------------------------------------------------------- | ||
|
||
$buffer = '<?php'; | ||
$buffer .= PHP_EOL; | ||
$buffer .= PHP_EOL; | ||
$buffer .= 'return '; | ||
$buffer .= var_export($availableDictionaries, true); | ||
$buffer .= ';'; | ||
$buffer .= PHP_EOL; | ||
|
||
file_put_contents($outputFilename, $buffer); | ||
|
||
// --------------------------------------------------------------------------------------------------------------------- | ||
|
||
echo PHP_EOL; | ||
echo sprintf('The available dictionaries are %s.', implode(', ', $availableDictionaries)); | ||
echo PHP_EOL; | ||
echo PHP_EOL; | ||
echo sprintf('Written resource file to %s', $outputFilename); | ||
echo PHP_EOL; | ||
echo PHP_EOL; | ||
|
||
// --------------------------------------------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
include_once 'bootstrap.php'; | ||
|
||
use TxTextControl\ReportingCloud\Console\Helper; | ||
use TxTextControl\ReportingCloud\ReportingCloud; | ||
|
||
$reportingCloud = new ReportingCloud([ | ||
'username' => Helper::username(), | ||
'password' => Helper::password(), | ||
]); | ||
|
||
// --------------------------------------------------------------------------------------------------------------------- | ||
|
||
var_dump($reportingCloud->getAvailableDictionaries()); | ||
|
||
// --------------------------------------------------------------------------------------------------------------------- | ||
|
||
var_dump($reportingCloud->getProofingSuggestions('ssky', 'en_US.dic', 10)); | ||
|
||
// --------------------------------------------------------------------------------------------------------------------- | ||
|
||
var_dump($reportingCloud->proofingCheck('Thiss is a testt about rockkets in the ssky', 'en_US.dic')); | ||
|
||
// --------------------------------------------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
return array ( | ||
0 => 'af_ZA.dic', | ||
1 => 'an_ES.dic', | ||
2 => 'ar.dic', | ||
3 => 'be_BY.dic', | ||
4 => 'bg_BG.dic', | ||
5 => 'br_FR.dic', | ||
6 => 'ca.dic', | ||
7 => 'cs_CZ.dic', | ||
8 => 'da_DK.dic', | ||
9 => 'de_AT_frami.dic', | ||
10 => 'de_CH_frami.dic', | ||
11 => 'de_DE_frami.dic', | ||
12 => 'el_GR.dic', | ||
13 => 'en_AU.dic', | ||
14 => 'en_CA.dic', | ||
15 => 'en_GB.dic', | ||
16 => 'en_US.dic', | ||
17 => 'en_US_Legal.txd', | ||
18 => 'en_US_OpenMedSpel.dic', | ||
19 => 'en_ZA.dic', | ||
20 => 'es_ES.dic', | ||
21 => 'et_EE.dic', | ||
22 => 'fa.dic', | ||
23 => 'fr.dic', | ||
24 => 'gd_GB.dic', | ||
25 => 'gl_ES.dic', | ||
26 => 'he_IL.dic', | ||
27 => 'hr_HR.dic', | ||
28 => 'hy_AM.dic', | ||
29 => 'it_IT.dic', | ||
30 => 'ku_TR.dic', | ||
31 => 'lt_LT.dic', | ||
32 => 'nb_NO.dic', | ||
33 => 'nl_NL.dic', | ||
34 => 'nn_NO.dic', | ||
35 => 'oc_FR.dic', | ||
36 => 'pl_PL.dic', | ||
37 => 'pt_BR.dic', | ||
38 => 'pt_PT.dic', | ||
39 => 'ro_RO.dic', | ||
40 => 'ru_RU.dic', | ||
41 => 'sh.dic', | ||
42 => 'sk_SK.dic', | ||
43 => 'sl_SI.dic', | ||
44 => 'sr.dic', | ||
45 => 'sv_SE.dic', | ||
46 => 'uk_UA.dic', | ||
47 => 'ur.dic', | ||
48 => 'vi_VN.dic', | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
/** | ||
* ReportingCloud PHP Wrapper | ||
* | ||
* PHP wrapper for ReportingCloud Web API. Authored and supported by Text Control GmbH. | ||
* | ||
* @link http://www.reporting.cloud to learn more about ReportingCloud | ||
* @link https://github.com/TextControl/txtextcontrol-reportingcloud-php for the canonical source repository | ||
* @license https://raw.githubusercontent.com/TextControl/txtextcontrol-reportingcloud-php/master/LICENSE.md | ||
* @copyright © 2017 Text Control GmbH | ||
*/ | ||
|
||
namespace TxTextControl\ReportingCloud\PropertyMap; | ||
|
||
/** | ||
* IncorrectWord property map | ||
* | ||
* @package TxTextControl\ReportingCloud | ||
* @author Jonathan Maron (@JonathanMaron) | ||
*/ | ||
class IncorrectWord extends AbstractPropertyMap | ||
{ | ||
/** | ||
* Set the property map of IncorrectWord | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->setMap([ | ||
'length' => 'length', | ||
'start' => 'start', | ||
'text' => 'text', | ||
'isDuplicate' => 'is_duplicate', | ||
'language' => 'language', | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.