July 2017
Beginner to intermediate
715 pages
17h 3m
English
In this next example, we will match different text samples based on their structure and similarity. We will still be using the ParagraphVectors class we used in the previous example. To begin, download the raw_sentences.txt file from GitHub (https://github.com/deeplearning4j/dl4j-examples/tree/master/dl4j-examples/src/main/resources) and add it to your project. This file contains a list of sentences which we will read in, label, and then compare.
First, we set up our ClassPathResource and assign an iterator to handle our file data. We have used a SentenceIterator for this example:
ClassPathResource srcFile = new ClassPathResource("/raw_sentences.txt"); File file = srcFile.getFile(); SentenceIterator iter = ...