How to read files in specific sequence from two different directories?

K

kdsutaria

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
 
B

Boaz.Jan

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

im sure this thread will help you on some of the frequency thing you
asked for
http://groups.google.com/group/comp...34/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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top