本文整理匯總了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();
}
});
}
示例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);
}
示例7: getPreProcessor
import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //導入依賴的package包/類
@Override
public SentencePreProcessor getPreProcessor() {
return sentencePreProcessor;
}
示例8: setPreProcessor
import org.deeplearning4j.text.sentenceiterator.SentencePreProcessor; //導入依賴的package包/類
@Override
public void setPreProcessor(SentencePreProcessor preProcessor) {
this.sentencePreProcessor = preProcessor;
}
示例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);
}
};
}
示例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);
}