Hamza Kouadri Hamza Kouadri - 2 months ago 19
C# Question

NTextCat how it works

if anyone know how i can use NTextCat in c#, I've downloaded but I found many of dll files, i don't know what i should use. This is its website http://ntextcat.codeplex.com
i found i code:

var factory = new RankedLanguageIdentifierFactory();
var identifier = factory.Load("Core14.profile.xml");
var languages = identifier.Identify("your text to get its language identified");
var mostCertainLanguage = languages.FirstOrDefault();
if (mostCertainLanguage != null)
Console.WriteLine("The language of the text is '{0}' (ISO639-3 code)",mostCertainLanguage.Item1.Iso639_3);
else
Console.WriteLine("The language couldn’t be identified with an acceptable degree of certainty");


but what i should do first what a dll i should use ect..

Answer

i did it by the way,for who's interested:

  1. you need to copy the folder you downloaded to your application directory ex."NTextCat0.2.1.1";
  2. browse and import dll "Ivankehayov.NTextCat.Lib.dll" and reference it in the project References;
  3. using IvanAkcheurov.NTextCat.Lib;
  4. var factory = new RankedLanguageIdentifierFactory(); var identifier = factory.Load("NTextCat 0.2.1.1\\LanguageModels\\Core14.profile.xml"); var languages = identifier.Identify("your text to get its language identified"); var mostCertainLanguage = languages.FirstOrDefault(); if (mostCertainLanguage != null)
    Console.WriteLine("The language of the text is '{0}' (ISO639-3 code)",mostCertainLanguage.Item1.Iso639_3);
    else Console.WriteLine("The language couldn’t be identified with an acceptable degree of certainty");

    n the line var identifier = factory.Load.... you must pay attention to any language profile you'll need to use for example i need to use Wiki82.profile.xml