当前位置: 首页>>代码示例>>Java>>正文


Java SentencePreProcessor类代码示例

本文整理汇总了Java中org.deeplearning4j.text.sentenceiterator.SentencePreProcessor的典型用法代码示例。如果您正苦于以下问题:Java SentencePreProcessor类的具体用法?Java SentencePreProcessor怎么用?Java SentencePreProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SentencePreProcessor类属于org.deeplearning4j.text.sentenceiterator包,在下文中一共展示了SentencePreProcessor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RottenTomatoesLabelAwareSentenceIterator

import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //导入依赖的package包/类
public RottenTomatoesLabelAwareSentenceIterator(SentencePreProcessor preProcessor) {
    this.preProcessor = preProcessor;
    try {
        TextRetriever retriever = new TextRetriever();
        this.phrases = new CopyOnWriteArrayList<>(retriever.phrases());
        this.labels = new CopyOnWriteArrayList<>(retriever.labels());
        System.out.println(labels.size());
    } catch (IOException e) {
        e.printStackTrace();
    }
    currRecord = new AtomicInteger(0);


}
 
开发者ID:ihuerga,项目名称:deeplearning4j-nlp-examples,代码行数:15,代码来源:RottenTomatoesLabelAwareSentenceIterator.java

示例2: RottenTomatoesLabelAwareDocumentIterator

import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //导入依赖的package包/类
public RottenTomatoesLabelAwareDocumentIterator(SentencePreProcessor preProcessor) {
    this.preProcessor = preProcessor;
    try {
        TextRetriever retriever = new TextRetriever();
        this.phrases = retriever.phrases();
        this.labels = retriever.labels();
    } catch (IOException e) {
        e.printStackTrace();
    }


}
 
开发者ID:ihuerga,项目名称:deeplearning4j-nlp-examples,代码行数:13,代码来源:RottenTomatoesLabelAwareDocumentIterator.java

示例3: before

import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //导入依赖的package包/类
@Before
public void before() throws Exception {

    ClassPathResource resource = new ClassPathResource("/raw_sentences.txt");
    File file = resource.getFile();
    iter = new LineSentenceIterator(file);
    iter.setPreProcessor(new SentencePreProcessor() {
        @Override
        public String preProcess(String sentence) {
            return sentence.toLowerCase();
        }
    });

}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:15,代码来源:GloveTest.java

示例4: getPreProcessor

import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //导入依赖的package包/类
@Override
public SentencePreProcessor getPreProcessor() {
    return preProcessor;
}
 
开发者ID:ihuerga,项目名称:deeplearning4j-nlp-examples,代码行数:5,代码来源:RottenTomatoesLabelAwareSentenceIterator.java

示例5: setPreProcessor

import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //导入依赖的package包/类
@Override
public void setPreProcessor(SentencePreProcessor preProcessor) {
    this.preProcessor = preProcessor;
}
 
开发者ID:ihuerga,项目名称:deeplearning4j-nlp-examples,代码行数:5,代码来源:RottenTomatoesLabelAwareSentenceIterator.java

示例6: LabelAwareUimaSentenceIterator

import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //导入依赖的package包/类
public LabelAwareUimaSentenceIterator(SentencePreProcessor preProcessor, String path, UimaResource resource) {
    super(preProcessor, path, resource);
}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:4,代码来源:LabelAwareUimaSentenceIterator.java

示例7: getPreProcessor

import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //导入依赖的package包/类
@Override
public SentencePreProcessor getPreProcessor() {
    return sentencePreProcessor;
}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:5,代码来源:LabelAwareListSentenceIterator.java

示例8: setPreProcessor

import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //导入依赖的package包/类
@Override
public void setPreProcessor(SentencePreProcessor preProcessor) {
    this.sentencePreProcessor = preProcessor;
}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:5,代码来源:LabelAwareListSentenceIterator.java

示例9: getLASI

import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //导入依赖的package包/类
protected LabelAwareSentenceIterator getLASI(final SentenceIterator iterator, final List<String> labels) {
    iterator.reset();

    return new LabelAwareSentenceIterator() {
        private AtomicInteger cnt = new AtomicInteger(0);

        @Override
        public String currentLabel() {
            return labels.get(cnt.incrementAndGet() % labels.size());
        }

        @Override
        public List<String> currentLabels() {
            return Collections.singletonList(currentLabel());
        }

        @Override
        public String nextSentence() {
            return iterator.nextSentence();
        }

        @Override
        public boolean hasNext() {
            return iterator.hasNext();
        }

        @Override
        public void reset() {
            iterator.reset();
        }

        @Override
        public void finish() {
            iterator.finish();
        }

        @Override
        public SentencePreProcessor getPreProcessor() {
            return iterator.getPreProcessor();
        }

        @Override
        public void setPreProcessor(SentencePreProcessor preProcessor) {
            iterator.setPreProcessor(preProcessor);
        }
    };
}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:48,代码来源:Word2VecDataSetIteratorTest.java

示例10: LabelAwareFileSentenceIterator

import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //导入依赖的package包/类
/**
 * Takes a single file or directory
 *
 * @param preProcessor the sentence pre processor
 * @param file         the file or folder to iterate over
 */
public LabelAwareFileSentenceIterator(SentencePreProcessor preProcessor, File file) {
    super(preProcessor, file);
}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:10,代码来源:LabelAwareFileSentenceIterator.java


注:本文中的org.deeplearning4j.text.sentenceiterator.SentencePreProcessor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。