• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

my inverted index not successfull

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 :
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

Henry
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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..
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... 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
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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,
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vita sari utami wrote:how to resolve this error?


By doing what Jesper and Campbell suggested.
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya ok sir,i'll not post any screen shots here after
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic