aspose file tools*
The moose likes Beginning Java and the fly likes my inverted index not successfull Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "my inverted index not successfull" Watch "my inverted index not successfull" New topic
Author

my inverted index not successfull

vita sari utami
Greenhorn

Joined: Jun 29, 2011
Posts: 13
i got a tutorial to make a inverted list until count with vector space, the content of tutorial code
already i type on edit plus editor, and i grouping my document in a directory, but there are 81 errors while i compiled.
help me... this is task from my lecture.. and deadline is not long again..

im an indonesian, sorry if my language not fluently...

please explain your question step by step... in order i stand with your describe..

this is my tutorial which i follow :
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18829
    
  40

vita sari utami wrote:i got a tutorial to make a inverted list until count with vector space, the content of tutorial code
already i type on edit plus editor, and i grouping my document in a directory, but there are 81 errors while i compiled.
help me... this is task from my lecture.. and deadline is not long again..


For a beginner, the only error that you should be concerned with is the first one -- just fix the first error and recompile again. As you get more comfortable with Java, you'll start to understand how error affect the next error, and you can start fixing them two or three at a time. In the mean time, just fix the first one.

And BTW, how were you ever able to create so much code without compiling earlier?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18829
    
  40


Also, if you are having a problem fixing the first error, then please show us the error message.

Henry
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38792
    
  23
Change all your fields from public to private. Delete the = null after each declaration.
It is bad practice to have public fields, and the null bit is unnecessary.
vita sari utami
Greenhorn

Joined: Jun 29, 2011
Posts: 13
Henry Wong wrote:
Also, if you are having a problem fixing the first error, then please show us the error message.

Henry


there are error occurence, while i try compling..

public short docType = DocumentIterator.TYPE_TEXT;
^
InvertedIndex.java:70: cannot find symbol
symbol : class TokenInfo
location: class InvertedIndex
tokenHash = new HashMap<String, TokenInfo>();
^
InvertedIndex.java:71: cannot find symbol
symbol : class DocumentReference
location: class InvertedIndex
docRefs = new ArrayList<DocumentReference>();
^
InvertedIndex.java:82: cannot find symbol
symbol : class TokenInfo
location: class InvertedIndex
tokenHash = new HashMap<String, TokenInfo>();
^
InvertedIndex.java:83: cannot find symbol
symbol : class DocumentReference
location: class InvertedIndex
docRefs = new ArrayList<DocumentReference>();
^
InvertedIndex.java:97: cannot find symbol
symbol : class DocumentIterator
location: class InvertedIndex
DocumentIterator docIter = new DocumentIterator(dirFile, docType, stem);
^
InvertedIndex.java:97: cannot find symbol
symbol : class DocumentIterator
location: class InvertedIndex
DocumentIterator docIter = new DocumentIterator(dirFile, docType, stem);
^
InvertedIndex.java:102: cannot find symbol
symbol : class FileDocument
location: class InvertedIndex
FileDocument doc = docIter.nextDocument();
^
InvertedIndex.java:105: cannot find symbol
symbol : class HashMapVector
location: class InvertedIndex
HashMapVector vector = doc.hashMapVector();
^
InvertedIndex.java:124: cannot find symbol
symbol : class Example
location: class InvertedIndex
for (Example example : examples) {
^
InvertedIndex.java:125: cannot find symbol
symbol : class FileDocument
location: class InvertedIndex
FileDocument doc = example.getDocument();
^
InvertedIndex.java:127: cannot find symbol
symbol : class HashMapVector
location: class InvertedIndex
HashMapVector vector = example.getHashMapVector();
^
InvertedIndex.java:141: cannot find symbol
symbol : class DocumentReference
location: class InvertedIndex
DocumentReference docRef = new DocumentReference(doc);
^
InvertedIndex.java:141: cannot find symbol
symbol : class DocumentReference
location: class InvertedIndex
DocumentReference docRef = new DocumentReference(doc);
^
InvertedIndex.java:145: cannot find symbol
symbol : class Weight
location: class InvertedIndex
for (Map.Entry<String, Weight> entry : vector.entrySet()) {
^
InvertedIndex.java:164: cannot find symbol
symbol : class TokenInfo
location: class InvertedIndex
TokenInfo tokenInfo = tokenHash.get(token);
^
InvertedIndex.java:167: cannot find symbol
symbol : class TokenInfo
location: class InvertedIndex
tokenInfo = new TokenInfo();
^
InvertedIndex.java:171: cannot find symbol
symbol : class TokenOccurrence
location: class InvertedIndex
tokenInfo.occList.add(new TokenOccurrence(docRef, count));
^
InvertedIndex.java:182: cannot find symbol
symbol : class TokenInfo
location: class InvertedIndex
Iterator<Map.Entry<String, TokenInfo>> mapEntries = tokenHash.entrySet().ite
rator();
^
InvertedIndex.java:185: cannot find symbol
symbol : class TokenInfo
location: class InvertedIndex
Map.Entry<String, TokenInfo> entry = mapEntries.next();
^
InvertedIndex.java:187: cannot find symbol
symbol : class TokenInfo
location: class InvertedIndex
TokenInfo tokenInfo = entry.getValue();
^
InvertedIndex.java:201: cannot find symbol
symbol : class TokenOccurrence
location: class InvertedIndex
for (TokenOccurrence occ : tokenInfo.occList) {
^
InvertedIndex.java:202: operator + cannot be applied to TokenOccurrence.docRef.l
ength,double
occ.docRef.length = occ.docRef.length + Math.pow(idf * occ.count, 2);
^
InvertedIndex.java:209: cannot find symbol
symbol : class DocumentReference
location: class InvertedIndex
for (DocumentReference docRef : docRefs) {
^
InvertedIndex.java:220: cannot find symbol
symbol : class TokenInfo
location: class InvertedIndex
for (Map.Entry<String, TokenInfo> entry : tokenHash.entrySet()) {
^
InvertedIndex.java:226: cannot find symbol
symbol : class TokenOccurrence
location: class InvertedIndex
for (TokenOccurrence occ : entry.getValue().occList) {
^
InvertedIndex.java:252: cannot find symbol
symbol : class TextStringDocument
location: class InvertedIndex
return retrieve(new TextStringDocument(input, stem));
^
InvertedIndex.java:272: cannot find symbol
symbol : class DocumentReference
location: class InvertedIndex
Map<DocumentReference, DoubleValue> retrievalHash =
^
InvertedIndex.java:272: cannot find symbol
symbol : class DoubleValue
location: class InvertedIndex
Map<DocumentReference, DoubleValue> retrievalHash =
^
InvertedIndex.java:273: cannot find symbol
symbol : class DocumentReference
location: class InvertedIndex
new HashMap<DocumentReference, DoubleValue>();
^
InvertedIndex.java:273: cannot find symbol
symbol : class DoubleValue
location: class InvertedIndex
new HashMap<DocumentReference, DoubleValue>();
^
InvertedIndex.java:277: cannot find symbol
symbol : class Weight
location: class InvertedIndex
for (Map.Entry<String, Weight> entry : vector.entrySet()) {
^
InvertedIndex.java:283: operator + cannot be applied to double,<any>
queryLength = queryLength + incorporateToken(token, count, retrievalHash);

^
InvertedIndex.java:283: incompatible types
found : <nulltype>
required: double
queryLength = queryLength + incorporateToken(token, count, retrievalHash);

^
InvertedIndex.java:289: cannot find symbol
symbol : class Retrieval
location: class InvertedIndex
Retrieval[] retrievals = new Retrieval[retrievalHash.size()];
^
InvertedIndex.java:289: cannot find symbol
symbol : class Retrieval
location: class InvertedIndex
Retrieval[] retrievals = new Retrieval[retrievalHash.size()];
^
InvertedIndex.java:293: cannot find symbol
symbol : class DocumentReference
location: class InvertedIndex
for (Map.Entry<DocumentReference, DoubleValue> entry : retrievalHash.entrySe
t()) {
^
InvertedIndex.java:293: cannot find symbol
symbol : class DoubleValue
location: class InvertedIndex
for (Map.Entry<DocumentReference, DoubleValue> entry : retrievalHash.entrySe
t()) {
^
InvertedIndex.java:294: cannot find symbol
symbol : class DocumentReference
location: class InvertedIndex
DocumentReference docRef = entry.getKey();
^
InvertedIndex.java:318: cannot find symbol
symbol : class Retrieval
location: class InvertedIndex
return new Retrieval(docRef, score);
^
InvertedIndex.java:335: cannot find symbol
symbol : class TokenInfo
location: class InvertedIndex
TokenInfo tokenInfo = tokenHash.get(token);
^
InvertedIndex.java:342: cannot find symbol
symbol : class TokenOccurrence
location: class InvertedIndex
for (TokenOccurrence occ : tokenInfo.occList) {
^
InvertedIndex.java:344: cannot find symbol
symbol : class DoubleValue
location: class InvertedIndex
DoubleValue val = retrievalHash.get(occ.docRef);
^
InvertedIndex.java:348: cannot find symbol
symbol : class DoubleValue
location: class InvertedIndex
val = new DoubleValue(0.0);
^
InvertedIndex.java:354: operator + cannot be applied to DoubleValue.value,double

val.value = val.value + weight * tokenInfo.idf * occ.count;
^
InvertedIndex.java:371: cannot find symbol
symbol : variable UserInput
location: class InvertedIndex
String query = UserInput.prompt("\nEnter query: ");
^
InvertedIndex.java:376: cannot find symbol
symbol : class HashMapVector
location: class InvertedIndex
HashMapVector queryVector = (new TextStringDocument(query, stem)).hashMapV
ector();
^
InvertedIndex.java:376: cannot find symbol
symbol : class TextStringDocument
location: class InvertedIndex
HashMapVector queryVector = (new TextStringDocument(query, stem)).hashMapV
ector();
^
InvertedIndex.java:377: cannot find symbol
symbol : class Retrieval
location: class InvertedIndex
Retrieval[] retrievals = retrieve(queryVector);
^
InvertedIndex.java:391: cannot find symbol
symbol : class Feedback
location: class InvertedIndex
Feedback fdback = null;
^
InvertedIndex.java:393: cannot find symbol
symbol : class Feedback
location: class InvertedIndex
fdback = new Feedback(queryVector, retrievals, this);
^
InvertedIndex.java:401: cannot find symbol
symbol : variable UserInput
location: class InvertedIndex
String command = UserInput.prompt("\n Enter command: ");
^
InvertedIndex.java:443: cannot find symbol
symbol : variable Browser
location: class InvertedIndex
System.out.println("Showing document " + showNumber + " in the " + Bro
wser.BROWSER_NAME + " window.");
^
InvertedIndex.java:444: cannot find symbol
symbol : variable Browser
location: class InvertedIndex
Browser.display(retrievals[showNumber - 1].docRef.file);
^
InvertedIndex.java:485: cannot find symbol
symbol : variable MoreString
location: class InvertedIndex
System.out.println(MoreString.padTo((i + 1) + ". ", 4) +
^
InvertedIndex.java:486: cannot find symbol
symbol : variable MoreString
location: class InvertedIndex
MoreString.padTo(retrievals[i].docRef.file.getName(), 20) +
^
InvertedIndex.java:488: cannot find symbol
symbol : variable MoreMath
location: class InvertedIndex
MoreMath.roundTo(retrievals[i].score, 5));
^
InvertedIndex.java:504: cannot find symbol
symbol : variable DocumentIterator
location: class InvertedIndex
short docType = DocumentIterator.TYPE_TEXT;
^
InvertedIndex.java:510: cannot find symbol
symbol : variable DocumentIterator
location: class InvertedIndex
docType = DocumentIterator.TYPE_HTML;
^
81 errors

Press any key to continue...



i hope you can help my error..

*deadline my task is entry
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18829
    
  40



You need to fix the first error. And from the print out you provided, it looks like you let the first error message scrolled off.

Henry
vita sari utami
Greenhorn

Joined: Jun 29, 2011
Posts: 13
Campbell Ritchie wrote:Change all your fields from public to private. Delete the = null after each declaration.
It is bad practice to have public fields, and the null bit is unnecessary.




still same error when i try follow your suggest
public convert private, and delete = null each declaration.

hint: in my directory C:\
i have 10 doc .txt to do indexing, but i dont placed it in this forum..

check it out, i placed my errors (what i have problem). please help..
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14146
    
  18

Many of the errors are "cannot find symbol" errors.

That means that Java can't find classes that you are using in the code: TokenInfo, DocumentReference, DocumentIterator, FileDocument, HashMapVector, Example, etc.

You are most likely missing some library in your classpath while you are compiling this code.

This looks like an awfully big and complicated program to work with if you're very new to Java. Maybe you should start with something smaller and simpler if you're learning Java.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38792
    
  23
... or comment out 90% of the code, get the other 10% to compile and then gradually un-comment the code. You should be compiling after every 5 or 10 lines of code. That way you will only have a few errors at a time to find.
vita sari utami
Greenhorn

Joined: Jun 29, 2011
Posts: 13
Campbell Ritchie wrote:... or comment out 90% of the code, get the other 10% to compile and then gradually un-comment the code. You should be compiling after every 5 or 10 lines of code. That way you will only have a few errors at a time to find.


sorry, i will tell you earlier. a month ago, i have task from my lecture, to build a inverted index, at finish use the "vector space" formula to compute similarity query with document. At a time, i got tutorial from internet how to build a inverted index plus used vector space. Nah, i follow step by step the code from tutorial, code from tutorial is code what i type at above, but when i compiling in my editor, there are 81 errors occur. how is the solving errors that occure?? so, i didnt make coding, but i just follow from the tutorial, how to resolve this error?

thanks,
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41823
    
  62
vita sari utami wrote:how to resolve this error?

By doing what Jesper and Campbell suggested.


Ping & DNS - my free Android networking tools app
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
Dear sir,

i have some doubts in the code which is there here for Inverted Index.. can you kindly help me with the code sir??? do this code will work for for only text processing or can be used for web pages also??? can you kindly tell me sir??? can you mail me the details sir???
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14146
    
  18

Welcome to the Ranch. Tell us what your questions about the code are, then we can see if someone has a helpful answer for you.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38792
    
  23
Welcome again

I would suggest you copy and compile all that code with the javadoc tool. Then inspect the resultant HTML files with a web browser, and see whether you can understand the documentation. If you can understand it, you can work out whether you can use this code. If you can’t understand it, you are back to the drawing board!
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
sir,

is this code can be used for only the text or can be used for accessing foe web application also???
then i have some data base for this code it searches some results in data base correctly but for some queries it does not search the results even if that name exists. i need to know why such problem occours???
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38792
    
  23
vijayalakshmi deepika wrote:sir,

is this code can be used for only the text or can be used for accessing foe web application also??? . . .
Don’t know. And I don’t care myself. I have no need to use this code myself, so I am not going to read 530 lines which throw a load of compiler errors to work out what it does.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38792
    
  23
vijayalakshmi deepika wrote:. . . can you mail me the details sir???
No, we avoid discussions off-forum. And please avoid multiple ??
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14146
    
  18

vijayalakshmi deepika wrote: is this code can be used for only the text or can be used for accessing foe web application also???

Looking through the code quickly I see no reason why it could not be used in a web application.
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
sir,
i would like to know whether the code will work for text documents alone or for html web documents also? and the text extraction on data base is used to retrieve some documents name like this
in data base it gives document name containing

apple fruit.htm,Apple Inc.doc,Apple.htm,apple fruit.txt, apple_inc.htm

query: company

it gives some documents with matching result,but if for the same

query:apple

it does not retrieve any document any document matching the query.

why is this problem occurring sir?may any one help me?
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
I think you missed Campbell's point: nobody here is going to go through 500 lines of code that don't even compile in order to figure out what it might or might not do. That's for you to figure out. If you have a specific question, maybe someone can help.

Also, please don't post screenshots - just copy and paste any error message you'd like us to look at, and post it here.
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
hi,
i have an doubt regarding the languages used here in the documents.will it suit to get output for all the languages or only for English.If it's possible to use other languages than English.How to link that and get the required output on cmd window or on applets?can any one help me?
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
ya ok sir,i'll not post any screen shots here after
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: my inverted index not successfull