zemberek.core.logging.Log.info()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中zemberek.core.logging.Log.info()方法的一些代码示例,展示了Log.info()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Log.info()方法的具体详情如下:
包路径:zemberek.core.logging.Log
类名称:Log
方法名:info

Log.info介绍

暂无

代码示例

代码示例来源:origin: ahmetaa/zemberek-nlp

public static void simpleSentenceBoundaryDetector() {
 String input =
   "Prof. Dr. Veli Davul açıklama yaptı. Kimse %6.5 lik enflasyon oranını beğenmemiş!" +
     " Oysa maçta ikinci olmuştuk... Değil mi?";
 Log.info("Paragraph = " + input);
 TurkishSentenceExtractor extractor = TurkishSentenceExtractor.DEFAULT;
 List<String> sentences = extractor.fromParagraph(input);
 Log.info("Sentences:");
 for (String sentence : sentences) {
  Log.info(sentence);
 }
}

代码示例来源:origin: ahmetaa/zemberek-nlp

public static void simpleTokenization() {
 Log.info("Simple tokenization returns a list of token strings.");
 TurkishTokenizer tokenizer = TurkishTokenizer.DEFAULT;
 String input = "İstanbul'a, merhaba!";
 Log.info("Input = " + input);
 Log.info("Tokenization list = " +
   Joiner.on("|").join(tokenizer.tokenizeToStrings("İstanbul'a, merhaba!")));
}

代码示例来源:origin: ahmetaa/zemberek-nlp

void info() {
 Log.info("There are %d sentences and %d tokens.",
   sentences.size(),
   sentences.stream().mapToInt(SentenceAnalysis::size).sum());
}

代码示例来源:origin: ahmetaa/zemberek-nlp

static void convertTweetData() throws IOException {
 Path in = Paths.get("/home/aaa/Downloads/20milyontweet/all_tweets.txt");
 Path out = Paths.get("/home/aaa/Downloads/20milyontweet/all_tweets-utf8");
 List<String> lines = Files.readAllLines(in, Charset.forName("iso-8859-9"));
 Log.info("Writing.");
 Files.write(out, lines, StandardCharsets.UTF_8);
}

代码示例来源:origin: ahmetaa/zemberek-nlp

void createGraph(BlockTextLoader corpusProvider, Path graphPath) throws Exception {
 Stopwatch sw = Stopwatch.createStarted();
 ContextualSimilarityGraph graph = buildGraph(corpusProvider, 1);
 Log.info("Serializing graph for random walk structure.");
 graph.serializeForRandomWalk(graphPath);
 Log.info("Serialized to %s", graphPath);
 Log.info("Graph created in %.3f seconds.",
   sw.elapsed(TimeUnit.MILLISECONDS) / 1000d);
}

代码示例来源:origin: ahmetaa/zemberek-nlp

public static void tokenIterator() {
 Log.info("Low level tokenization iterator using Ant-lr Lexer.");
 String input = "İstanbul'a, merhaba!";
 Log.info("Input = " + input);
 Iterator<Token> tokenIterator = tokenizer.getTokenIterator(input);
 while (tokenIterator.hasNext()) {
  Token token = tokenIterator.next();
  Log.info("Token = " + token.getText() +
    ", Type = " + TurkishLexer.VOCABULARY.getDisplayName(token.getType()));
 }
}

代码示例来源:origin: ahmetaa/zemberek-nlp

void dataInfo(List<String> lines) {
 Log.info("Total lines = " + lines.size());
 Histogram<String> hist = new Histogram<>();
 lines.stream()
   .map(s -> s.substring(0, s.indexOf(' ')))
   .forEach(hist::add);
 Log.info("Categories :");
 for (String s : hist.getSortedList()) {
  Log.info(s + " " + hist.getCount(s));
 }
}

代码示例来源:origin: ahmetaa/zemberek-nlp

void dataInfo(List<String> lines) {
 Log.info("Total lines = " + lines.size());
 Histogram<String> hist = new Histogram<>();
 lines.stream()
   .map(s -> s.substring(0, s.indexOf(' ')))
   .forEach(hist::add);
 Log.info("Categories :");
 for (String s : hist.getSortedList()) {
  Log.info(s + " " + hist.getCount(s));
 }
}

代码示例来源:origin: ahmetaa/zemberek-nlp

public static void main(String[] args) {
 TurkishMorphology morphology = TurkishMorphology.createWithDefaults();
 String word = "kutucuğumuz";
 Log.info("Word = " + word);
 Log.info("Results: ");
 WordAnalysis results = morphology.analyze(word);
 for (SingleAnalysis result : results) {
  Log.info(result.formatLong());
  Log.info("\tStems = " + result.getStems());
  Log.info("\tLemmas = " + result.getLemmas());
 }
}

代码示例来源:origin: ahmetaa/zemberek-nlp

static void testModel(Path root, Path test, String name) {
 Log.info("Testing...");
 Path modelPath = root.resolve(name + ".model");
 Path predictions = root.resolve(name + ".predictions");
 new EvaluateClassifier().execute(
   "-i", test.toString(),
   "-m", modelPath.toString(),
   "-o", predictions.toString(),
   "-k", "1"
 );
}

代码示例来源:origin: ahmetaa/zemberek-nlp

public CorpusDb(Path dbRoot) throws IOException, SQLException {
 if (dbRoot.toFile().exists() && !dbRoot.toFile().isDirectory()) {
  throw new IllegalArgumentException("Database root path is not a directory :" + dbRoot);
 }
 if (!dbRoot.toFile().exists()) {
  Log.info("Creating database root folder %s", dbRoot);
  Files.createDirectories(dbRoot);
 }
 this.dbPath = dbRoot.resolve("data");
 connectionPool = JdbcConnectionPool.create(getJdbcConnectionString(), "sa", "sa");
 createTablesIfNotExist();
}

代码示例来源:origin: ahmetaa/zemberek-nlp

public static void main(String[] args) throws IOException {
 DistanceList experiment = DistanceList.readFromBinary(
   Paths.get("/media/depo/data/aaa/corpora/distance-large-min10.bin"),
   Paths.get("/media/depo/data/aaa/corpora/vocab-large-min10.bin"));
 Log.info("Writing");
 experiment.saveReduced(Paths.get("/media/depo/data/aaa/corpora/distance-10.bin"), 10);
}

代码示例来源:origin: ahmetaa/zemberek-nlp

private WebCorpus getWebCorpus(Path input) throws IOException {
 Log.info("Loading %s", input);
 WebCorpus wc = new WebCorpus(input.toFile().getName(), input.toFile().getName());
 wc.addDocuments(WebCorpus.loadDocuments(input));
 return wc;
}

代码示例来源:origin: ahmetaa/zemberek-nlp

public Builder addTextDictionaryResources(Collection<String> resources) throws IOException {
 Log.info("Dictionaries :%s", String.join(", ", resources));
 List<String> lines = new ArrayList<>();
 for (String resource : resources) {
  lines.addAll(TextIO.loadLinesFromResource(resource));
 }
 lexicon.addAll(TurkishDictionaryLoader.load(lines));
 return this;
}

代码示例来源:origin: ahmetaa/zemberek-nlp

Vocabulary collectVocabularyHistogram(BlockTextLoader corpora, int threadCount)
  throws Exception {
 ExecutorService executorService = new BlockingExecutor(threadCount);
 Vocabulary result = new Vocabulary();
 for (TextChunk chunk : corpora) {
  Log.info("Processing %s", chunk);
  executorService.submit(new WordCollectorTask(chunk, result));
 }
 executorService.shutdown();
 executorService.awaitTermination(1, TimeUnit.DAYS);
 return result;
}

代码示例来源:origin: ahmetaa/zemberek-nlp

public RuleBasedDisambiguator(TurkishMorphology analyzer, Rules rules)
  throws IOException {
 this.analyzer = analyzer;
 Log.info("Loading 100k word frequencies.");
 List<String> freqLines = TextIO.loadLinesFromCompressedResource("/ambiguity/freq-100k.txt.gz");
 wordFreq = Histogram.loadFromLines(freqLines, ' ');
 this.rules = rules;
}

代码示例来源:origin: ahmetaa/zemberek-nlp

@Override
public void run() throws Exception {
 ZemberekGrpcConfiguration configuration = null;
 if (dataRoot != null) {
  IOUtil.checkDirectoryArgument(dataRoot, "Zemberek External Data Root");
  Log.info("Zemberek external data root is : %s", dataRoot.toFile().getAbsolutePath());
  configuration = ZemberekGrpcConfiguration.fromDataRoot(dataRoot);
 }
 ZemberekGrpcServer server = new ZemberekGrpcServer(port, configuration);
 server.start();
}

代码示例来源:origin: ahmetaa/zemberek-nlp

@Override
public void analyzeSentence(SentenceAnalysisRequest request,
  StreamObserver<SentenceAnalysisProto> responseObserver) {
 String sentence = request.getInput();
 SentenceAnalysis a = morphology.analyzeAndDisambiguate(sentence);
 Log.info("Sentence = %s", sentence);
 responseObserver.onNext(toSentenceAnalysis(a, request.getContainAllAnalyses()));
 responseObserver.onCompleted();
}

代码示例来源:origin: ahmetaa/zemberek-nlp

public static TurkishMorphology createWithDefaults() {
 Stopwatch sw = Stopwatch.createStarted();
 TurkishMorphology instance = new Builder().setLexicon(RootLexicon.getDefault()).build();
 Log.info("Initialized in %d ms.", sw.elapsed(TimeUnit.MILLISECONDS));
 return instance;
}

代码示例来源:origin: ahmetaa/zemberek-nlp

static Model loadFromTextFile(Path file) throws IOException {
 FloatValueMap<String> data = new FloatValueMap<>(10000);
 List<String> all = TextIO.loadLines(file);
 for (String s : all) {
  float weight = Float.parseFloat(Strings.subStringUntilFirst(s, " "));
  String key = Strings.subStringAfterFirst(s, " ");
  data.set(key, weight);
 }
 Log.info("Model Loaded.");
 return new Model(data);
}

相关文章

微信公众号

最新文章

更多