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

Discussion in 'Java' started by kdsutaria, Feb 17, 2007.

  1. kdsutaria

    kdsutaria Guest

    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
    kdsutaria, Feb 17, 2007
    #1
    1. Advertising

  2. kdsutaria

    Guest

    On Feb 17, 10:10 pm, "kdsutaria" <> wrote:
    > 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)
    , Feb 17, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nicolas Fleury

    Two sub-packages in different directories

    Nicolas Fleury, Feb 17, 2004, in forum: Python
    Replies:
    1
    Views:
    251
    Peter Otten
    Feb 18, 2004
  2. GenxLogic
    Replies:
    3
    Views:
    1,242
    andrewmcdonagh
    Dec 6, 2006
  3. Sophie PARISOT

    How to use different asmx in different sub-directories ?

    Sophie PARISOT, Feb 8, 2006, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    184
    Satish
    Feb 13, 2006
  4. Adam Petrie
    Replies:
    8
    Views:
    292
    Adam Petrie
    Oct 11, 2004
  5. Jabba Laci
    Replies:
    1
    Views:
    119
    Roy Smith
    Oct 6, 2013
Loading...

Share This Page