Anthony Alexander

Greenhorn
+ Follow
since Feb 16, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Anthony Alexander

Yes. Yes. Good idea. that may work. thanks.
18 years ago
OK Here goes. It is a information retrieval program. You will need ten text files (words.txt-words10.txt) to run it.

It is still in progress so it may be hard to follow.

18 years ago
Say I have two treemaps A and B defined as : <String, Integer>

eg.

Tree Map A
-----------
apple, 4
orange, 2

Tree Map B
-----------
banana, 3
orange, 1


How do I search for identical keys (orange in this example) and use the values for each key (eg. 2 + 1 = 3)?

Do I have to loop through every treemap looking at every key?
18 years ago
How come when I have an array of TreeMaps and I try to view some values, I only see the last entry?



other part of code segment:


I apologise, N is defined in main program as 10 and there are already items in WeightData array treemap at this point.
18 years ago
List DocRef;
frequencyData.put(word,DocRef.add(x));


???
18 years ago
It seems to be possible but how do I add to the list?

Before I could do:

frequencyData.put(word,x);
(when it was string,integer)

but how do I add to the list?
18 years ago
At the moment I have a Tree Map consisting of a String and Integer,

TreeMap<String, Integer> frequencyData = new TreeMap<String, Integer>( );


The problem now is that I need to hold more than one integer for each string.
Is it possible to have:

TreeMap<String, List>

?
18 years ago
Thanks you have been a great help.


I am now working on having a tree set within a separate treemap (i'm not sure if that makes sense), as I need to have a list of numbers for each word.

At the moment I have an array of ten treemaps for each document containing the term (word) and frequency. <String, int>

The next stage is to create another normal tree map which contains term and list of document numbers it appears in. <String, List int?>

eg.
term list
----- -----
[java] [0] [3] [4]
[the] [1] [8]

java appears in docs 0,3,4.
18 years ago
Good idea but I get error:

Cannot create a generic array of Map<String,Integer>


I'm gonna try and see what the notation is for creating an array of tree maps.
18 years ago
Outline
-------
My java program saves the words from ten text files into a tree map called frequencyData (it also records the frequency of each word).

There is a for loop to read each document file and the names of each file are stored in a string array (Docs).

Question
--------
How can I change the program so that a tree map is made for each document file? [I'm guessing a will have to create a new tree map within the for loop.]

Also, How do I determine the name of each new tree map? (eg. frequencyData1, frequencyData2....frequencyData10)





18 years ago
18 years ago
Can some one tell what is the difference between a tree map and a hash map?

Is there any noticable pros and cons between the two?
18 years ago
I have taken your advice, I have done this:



There is a for loop to read ten text files and at the moment every term is saved into one tree map called frequency data.

I need to work out how to create a new Tree map for each document.

Should this be in the for loop or should I create a certain number of treemaps based on how documents there are?

Thanks for the help,
18 years ago
Sorry table should be like this:



eg.
machine appears in 2 documents (22 and 44, 17 times and 3 times respectively).
18 years ago
Hello

I am in serious need for a solution for creating an inverted index for a information retrieval project. The program works by reading ten text files and accepting a user query (which I have already done).

Has anyone done Information retrieval in java before?

Do I have to create Hash Maps or Tree Sets or ArrayList to do Vector Representation.

I need to store:
-----------------
Index Term (String) ,
Doc Frequency (int) ,
Document Number/ID (int),
Term Frequency (int).


An example of output should be:

IndexTerm DocFreq DocNum TermFreq
-------------------------------------------------
java 3 1 5 67 2 5 12
machine 2 22 44 17 3



So this means java appears in three documents (In doc one 2 times, doc five 5 times, etc).


Thanks for your time
18 years ago