vsm :: StringIndex
vsm :: StringIndex :: defaultinit
vsm :: StringIndex :: index_string
Index a new Document fromtitle
, uri
and string string
.
vsm :: StringIndex :: match_string
Match thequery
string against all indexed documents
vsm :: StringIndex :: parse_string
Parse thestring
as a Vector
vsm $ StringIndex :: SELF
Type of this instance, automatically specialized in every classcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
vsm :: StringIndex :: defaultinit
vsm :: VSMIndex :: defaultinit
core :: Object :: defaultinit
vsm :: VSMIndex :: index_document
Index a documentvsm :: StringIndex :: index_string
Index a new Document fromtitle
, uri
and string string
.
vsm :: VSMIndex :: inverse_doc_frequency
Inverse document frequencyvsm :: VSMIndex :: inverse_doc_frequency=
Inverse document frequencyvsm :: VSMIndex :: inversed_index
Inversed indexvsm :: VSMIndex :: inversed_index=
Inversed indexcore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
vsm :: StringIndex :: match_string
Match thequery
string against all indexed documents
vsm :: VSMIndex :: match_vector
Matchquery
vector to all index document vectors
core :: Object :: output_class_name
Display class name on stdout (debug only).vsm :: StringIndex :: parse_string
Parse thestring
as a Vector
vsm :: VSMIndex :: terms_doc_count
Count for all terms in all indexed documentsvsm :: VSMIndex :: terms_doc_count=
Count for all terms in all indexed documents
# A VSM index to store strings
class StringIndex
super VSMIndex
# Index a new Document from `title`, `uri` and string `string`.
#
# Return the Document created.
#
# See `index_document`.
fun index_string(title, uri, string: String, auto_update: nullable Bool): DOC do
var vector = parse_string(string)
var doc = new Document(title, uri, vector)
index_document(doc, auto_update)
return doc
end
# Match the `query` string against all indexed documents
#
# See `match_vector`.
fun match_string(query: String): Array[IndexMatch[DOC]] do
var vector = parse_string(query)
var doc = new Document("", "", vector)
return match_vector(doc.terms_frequency)
end
# Parse the `string` as a Vector
#
# Returns a vector containing the terms of `string`.
fun parse_string(string: String): Vector do
var reader = new StringReader(string)
var vector = new Vector
loop
var token = reader.read_word
if token == "" then break
vector.inc(token)
end
return vector
end
end
lib/vsm/vsm.nit:215,1--253,3