hi!
I hv to read two files together from different dirs and need
to find pair of word frequency and document frequency of this pair of
word.
for example.
both dirs has 10000 .xml files and having partial same name to
recognize two pair of files.
T1.xml from A dir L1.xml from B dir
words
a,b,c a1,b1
i need to find word frequency and document frequency of
aa1,ab1,ba1,bb1,ca1,cb1.
can any one suggest me , How do i read and recognize two files from
two different directory ?
ksut
Boaz.Jan@gmail.com - 17 Feb 2007 23:34 GMT
> hi!
> I hv to read two files together from different dirs and need
[quoted text clipped - 15 lines]
> two different directory ?
> ksut
im sure this thread will help you on some of the frequency thing you
asked for
http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/99
51cc38c938ae34/0e245cef97d7a9cf?lnk=raot#0e245cef97d7a9cf
for the file itrating in the directory for the corrasponding file (i
hope i understood what you want to do...) you can do so with the
"File" class
http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html
it represnet a Entity in the FileSystem (File, Dir and whatever)
you will find these methods usefull:
isDirectory()
isFile()
list()
list(FilenameFilter filter)
listFiles()
listFiles(FilenameFilter filter)
getPath()
after you got all the files into object just parse the relavnt data of
each path from each file (the File.listFiles() method return a
File[] ) and search for the corresponding file at the other File[]
for the reading part just use a bufferdreader (http://java.sun.com/
docs/books/tutorial/essential/io/index.html)