Anton,
Please don't cross post "How do I..." questions to the dev list, it
doesn't get you anywhere and just annoys those most likely to help you.
See below.
-Grant
Anton Feldmann wrote:
Hi
I wrote a Indexer which is indexing all the contents of a text and the
sentence are seperated in an other Document.
"Document document = new Document(new Field ("contents", reader ));
StringTokenizer token = new StringTokenizer(contents.replaceAll(". ", "\\.x\\") , "\\.x\\");
while(token.hasMoreTokens()){
Document doc = new Document();
doc.add(new Field ("sentence", token.nextToken(),Field.Store.YES,
Field.Index.TOKENIZED) );
}"
1) How do I write a Lucene Search and display all the hits in an
document?
SpanQuery can give you information about where matches take place. If
you are looking for a more basic answer, then refer to the demo on how
to do a search that returns Hits or the well-written "Lucene In Action".
2) How do I display the sentence the hit is in? and color the hit.
Use the Highlighter contrib package.
3) How do I display the sentence before and after the sentence the hit
is in?
Not sure. You probably need some way of keeping track of where the
sentences occur. See my previous answer to a similar question you asked
about how to index and search sentences. I, personally, think you need
to have a Document per sentence, with some metadata fields about where
that sentence takes place, but others may have alternate ideas. You
_could_, instead of having each field be named "sentence", have the
field name reflect which sentence it is, along with a catch all field,
but this would make querying a lot harder.
Cherrs
anton
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Grant Ingersoll
Sr. Software Engineer
Center for Natural Language Processing
Syracuse University
School of Information Studies
335 Hinds Hall
Syracuse, NY 13244
http://www.cnlp.org
Voice: 315-443-5484
Fax: 315-443-6886
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]