2017 © Pedro Peláez
 

symfony-bundle text-language-detect-bundle

Bundle to use Text_LanguageDetect with Symfony2.

image

webmil/text-language-detect-bundle

Bundle to use Text_LanguageDetect with Symfony2.

  • Friday, March 23, 2012
  • by Webmil
  • Repository
  • 3 Watchers
  • 3 Stars
  • 2,536 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

WebmilTextLanguageDetectBundle

Bundle to use text-language-detect with Symfony2., (*1)

Installation

Add text-language-detect and WebmilTextLanguageDetectBundle to your vendors:, (*2)

git submodule add https://github.com/webmil/text-language-detect.git vendor/text-language-detect
git submodule add https://github.com/webmil/WebmilTextLanguageDetectBundle.git vendor/bundles/Webmil/TextLanguageDetectBundle

Or add the followings lines to your deps file, (*3)

// deps
[WebmilTextLanguageDetectBundle]
    git=git://github.com/webmil/WebmilTextLanguageDetectBundle.git
    target=bundles/Webmil/TextLanguageDetectBundle

[text-language-detect]
    git=git://github.com/webmil/text-language-detect.git

and run:, (*4)

$ ./bin/vendors install

Add both to your autoload:, (*5)

``` php // app/autoload.php <?php $loader->registerNamespaces(array( // ... 'Webmil' => DIR.'/../vendor/bundles', 'TextLanguageDetect' => DIR.'/../vendor/text-language-detect/lib', // ... ));, (*6)


Add the WebmilTextLanguageDetectBundle to your application kernel: ``` php // app/AppKernel.php <?php public function registerBundles() { return array( // ... new Webmil\TextLanguageDetectBundle\WebmilTextLanguageDetectBundle(), // ... ); }

Configuration example

Add in your config.yml file:, (*7)

``` yaml webmil_text_language_detect: omit_languages: # Omits languages. If you're only expecting a limited set of languages, this can greatly omit_list: ['russian', 'english', 'ukrainian'] # language name or array of names to omit include_only: true # if true will include (rather than exclude) only those in the list, (*8)


Usage ----- In controller: ``` php <?php // ... $ld = $this->container->get('text.language.detect'); //or just $this->get('language.detect') $text = 'Test language detection.'; $lang = $ld->detectConfidence($text); //...

print_r($lang):, (*9)

// output
Array
(
    [language] => english
    [similarity] => 0.33985507246377
    [confidence] => 0.018985507246377
)

License

Bundle is licensed under the MIT License. See the LICENSE file for full details., (*10)

Author

Webmil, (*11)

The Versions

23/03 2012

dev-master

9999999-dev

Bundle to use Text_LanguageDetect with Symfony2.

  Sources   Download

MIT

The Requires

 

by Oleh Popadjuk

language detect text language detect