Learn R Programming

lsa (version 0.73.4)

query: Query (Matrices)

Description

Create a query in the format of a given textmatrix.

Usage

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

Value

query

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

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.

Author

Fridolin Wild f.wild@open.ac.uk

Details

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

See Also

wordStem, textmatrix

Examples

Run this code

# 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)

Run the code above in your browser using DataLab