當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。