You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now, when we create a library, we can use following ways:
new Language() - following directory will be used (by default): DIR . '/../../resources//.json';
We use other .json-files (take as an example, en language):
2.1 Create at any place folder $dirname=LanguageDetection/en/.
2.2 Put there your own text file: en.txt.
2.3 Train library:
$t = new Trainer();
$t->learn($dirname);
2.4 Then use newly created/updated .json-file: LanguageDetection/en/en.json by:
new Language([], $dirname)
So, if we want to use default lang file, we should:
Copy already existing en.txt to our newly created folder.
Add our text to existing
Train library.
Use newly created/updated en.json
Request:
Not to copy-paste, it would be good have a possibility to use already existing en.json and newly created together, something like: new Language([], $dirname, $useDefaultFile = true):
3rd params by default is false
if dirname is defined and $useDefaultFile=true: use 2 path together - default one ( __DIR__ . '/../../resources/*/*.json'_)
and new - dirname
The text was updated successfully, but these errors were encountered:
Sorry for waiting so long... It's not as easy as I thought. I've stumpled across some issues here.
When merging both directories (default and user directory), we also have to merge the language files. But we can't just merge the language files, because they are pre-sorted and merging would destroy the order.
Hello,
Now, when we create a library, we can use following ways:
new Language() - following directory will be used (by default): DIR . '/../../resources//.json';
We use other .json-files (take as an example, en language):
2.1 Create at any place folder $dirname=LanguageDetection/en/.
2.2 Put there your own text file: en.txt.
2.3 Train library:
2.4 Then use newly created/updated .json-file: LanguageDetection/en/en.json by:
new Language([], $dirname)
So, if we want to use default lang file, we should:
Request:
Not to copy-paste, it would be good have a possibility to use already existing en.json and newly created together, something like:
new Language([], $dirname, $useDefaultFile = true):
__DIR__ . '/../../resources/*/*.json'_)
and new - dirname
The text was updated successfully, but these errors were encountered: