query {lsa}R Documentation

Query (Matrices)

Description

Create a query in the format of a given textmatrix.

Usage

query ( qtext, termlist, stemming=FALSE, language="german" )

Arguments

termlist

the termlist of the background latent-semantic space.

language

specifies a language for stemming / stop-word-removal.

stemming

boolean, specifies whether all terms will be reduced to their wordstems.

qtext

the query string, words are separated by blanks.

Details

Create queries, i.e., an additional term vector to be used for query-to-document comparisons, in the format of a given textmatrix.

Value

query

returns the query vector (based on the given vocabulary) as matrix.

Author(s)

Fridolin Wild f.wild@open.ac.uk

See Also

wordStem, textmatrix

Examples


# prepare some files
td = tempfile()
dir.create(td)
write( c("dog", "cat", "mouse"), file=paste(td,"D1", sep="/") )
write( c("hamster", "mouse", "sushi"), file=paste(td,"D2", sep="/") )
write( c("dog", "monster", "monster"), file=paste(td,"D3", sep="/") )

# demonstrate generation of a query
dtm = textmatrix(td)
query("monster", rownames(dtm))
query("monster dog", rownames(dtm))

# clean up
unlink(td, TRUE)


[Package lsa version 0.73.3 Index]