Class Model
java.lang.Object
org.apache.nutch.scoring.similarity.cosine.Model
This class creates a model used to store Document vector representation of the corpus.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatcomputeCosineSimilarity(DocVector docVector) static DocVectorcreateDocVector(String content, int mingram, int maxgram) Used to create a DocVector from given String text.static voidcreateModel(Configuration conf) static int[]retrieveNgrams(Configuration conf) Retrieves mingram and maxgram from configuration
-
Field Details
-
docVectors
-
isModelCreated
public static boolean isModelCreated
-
-
Constructor Details
-
Model
public Model()
-
-
Method Details
-
createModel
- Throws:
IOException
-
createDocVector
Used to create a DocVector from given String text. Used during the parse stage of the crawl cycle to create a DocVector of the currently parsed page from the parseText attribute value- Parameters:
content- The text to tokenizemingram- Value of mingram for tokenizingmaxgram- Value of maxgram for tokenizing- Returns:
- The created
DocVector
-
computeCosineSimilarity
-
retrieveNgrams
Retrieves mingram and maxgram from configuration- Parameters:
conf- Configuration to retrieve mingram and maxgram- Returns:
- ngram array as mingram at first index and maxgram at second index
-