use of zemberek.morphology.analysis.tr.TurkishMorphology in project zemberek-nlp by ahmetaa.
the class UnidentifiedTokenAnalyzerTest method shouldCreateUnidentifiedTokenParserSuccessfully.
@Test
public void shouldCreateUnidentifiedTokenParserSuccessfully() throws IOException {
TurkishMorphology parser = TurkishMorphology.createWithDefaults();
UnidentifiedTokenAnalyzer uiParser = new UnidentifiedTokenAnalyzer(parser);
List<WordAnalysis> results = uiParser.analyze("Ankara'ya");
for (WordAnalysis result : results) {
System.out.println(result);
}
}
use of zemberek.morphology.analysis.tr.TurkishMorphology in project zemberek-nlp by ahmetaa.
the class ZemberekNlpScripts method testWordAnalysis.
@Test
@Ignore("Not a Test.")
public void testWordAnalysis() throws IOException {
TurkishMorphology morphology = TurkishMorphology.createWithDefaults();
List<WordAnalysis> results = morphology.analyze("phpye");
for (WordAnalysis result : results) {
Log.info(result.formatLong());
Log.info("\tStems = " + result.getStems());
Log.info("\tLemmas = " + result.getLemmas());
}
}
use of zemberek.morphology.analysis.tr.TurkishMorphology in project zemberek-nlp by ahmetaa.
the class ZemberekNlpScripts method testSentenceAnalysis.
@Test
@Ignore("Not a Test.")
public void testSentenceAnalysis() throws IOException {
TurkishMorphology morphology = TurkishMorphology.createWithDefaults();
Z3MarkovModelDisambiguator disambiguator = new Z3MarkovModelDisambiguator();
TurkishSentenceAnalyzer analyzer = new TurkishSentenceAnalyzer(morphology, disambiguator);
String sentence = "Kırmızı kalemi al.";
Log.info("Sentence = " + sentence);
SentenceAnalysis analysis = analyzer.analyze(sentence);
Log.info("Before disambiguation.");
writeParseResult(analysis);
Log.info("\nAfter disambiguation.");
analyzer.disambiguate(analysis);
writeParseResult(analysis);
}
use of zemberek.morphology.analysis.tr.TurkishMorphology in project zemberek-nlp by ahmetaa.
the class ZemberekNlpScripts method disambiguationMemoryTest.
@Test
@Ignore("Not a Test.")
public void disambiguationMemoryTest() throws IOException {
List<String> lines = Files.readAllLines(Paths.get("/media/depo/data/aaa/corpora/dunya.100k"));
TurkishMorphology parser = TurkishMorphology.createWithDefaults();
TurkishSentenceAnalyzer sentenceAnalyzer = new TurkishSentenceAnalyzer(parser, new Z3MarkovModelDisambiguator());
int k = 0;
for (int i = 0; i < 100; i++) {
Stopwatch sw = Stopwatch.createStarted();
for (String line : lines) {
k += sentenceAnalyzer.bestParse(line).size();
}
Log.info(sw.elapsed(TimeUnit.MILLISECONDS));
}
Log.info(k);
}
use of zemberek.morphology.analysis.tr.TurkishMorphology in project zemberek-nlp by ahmetaa.
the class ParseConsole method main.
public static void main(String[] args) throws IOException {
// to test the development lexicon, use ParseConsoleTest
// TurkishMorphology morphology = TurkishMorphology.createWithDefaults();
TurkishMorphology morphology = TurkishMorphology.builder().addDefaultDictionaries().build();
// morphology.getGraph().stats();
new ParseConsole().run(morphology);
}
Aggregations