Skip to content

Create langLibrary form different directories #24

@IgorFrancais

Description

@IgorFrancais

Hello,

Now, when we create a library, we can use following ways:

  1. new Language() - following directory will be used (by default): DIR . '/../../resources//.json';

  2. 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:

  1. Copy already existing en.txt to our newly created folder.
  2. Add our text to existing
  3. Train library.
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions