public static function createDefault(DictionaryInterface $dictionary = null)
    {
        /** @var LanguageDetector $detector */
        $detector = new static();

        $dataDirectory = realpath(__DIR__ . '/../../../data');

        $alphabetLoader = new AlphabetLoader();
        $sectionLoader = new SectionLoader();

        $sections = $sectionLoader->load($dataDirectory . '/sections.yml');
        $alphabets = $alphabetLoader->load($dataDirectory . '/alphabets.yml');

        $detector
            ->addVisitor(new SectionVisitor($sections), -1024)
            ->addVisitor(new AlphabetVisitor($alphabets), -512);

        if ($dictionary) {
            $detector->addVisitor(new DictionaryVisitor($dictionary), -256);
        }

        return $detector;
    }
public static function createDefault(DictionaryInterface $dictionary = null)
    {
        /** @var LanguageDetector $detector */
        $detector = new static();

        $dataDirectory = realpath(__DIR__ . '/../../../data');

        $alphabetLoader = new AlphabetLoader();
        $sectionLoader = new SectionLoader();

        $sections = $sectionLoader->load($dataDirectory . '/sections.yml');
        $alphabets = $alphabetLoader->load($dataDirectory . '/alphabets.yml');

        $detector
            ->addVisitor(new SectionVisitor($sections), -1024)
            ->addVisitor(new AlphabetVisitor($alphabets), -512);

        if ($dictionary) {
            $detector->addVisitor(new DictionaryVisitor($dictionary), -256);
        }

        return $detector;
    }
public static function createDefault ( DictionaryInterface $ dictionary = null ) { /** @var LanguageDetector $detector */ $ detector = new static ( ) ; $ dataDirectory = realpath ( __DIR__ . '/../../../data' ) ; $ alphabetLoader = new AlphabetLoader ( ) ; $ sectionLoader = new SectionLoader ( ) ; $ sections = $ sectionLoader -> load ( $ dataDirectory . '/sections.yml' ) ; $ alphabets = $ alphabetLoader -> load ( $ dataDirectory . '/alphabets.yml' ) ; $ detector -> addVisitor ( new SectionVisitor ( $ sections ) , - 1024 ) -> addVisitor ( new AlphabetVisitor ( $ alphabets ) , - 512 ) ; if ( $ dictionary ) { $ detector -> addVisitor ( new DictionaryVisitor ( $ dictionary ) , - 256 ) ; } return $ detector ; }
Create default detector

@param DictionaryInterface $dictionary

@return LanguageDetector
Create default detector