What is the best way to store and iterate over lists of words?

Hi,
Im trying to create a naive bayesian classifier to attribute aurthorship to some texts. I have three text files in the form of a list of words (listA, listB and listC, where listA is a disputed text and listB, listC are those of known authors). I need to feed these into my program, than compare listA to listB (to check if listA has the same words as listB), perform the classification and do the same for listA and listC.
Im new to java and would like to know the best way of comparing the text files....could i store listA in an array....listB in a hashmap, iterate over the hashmap to check which words are also contained in listA and store the similar words in a seperate arraylist?
plz help.

If you just want to check if one set of words contains another set of words then something implementing java.util.Set might be sufficient. Read the API docs, you don't need to write much code yourself. Maps are for looking up values based on keys; your problem statement doesn't mention that so you don't need them. Lists are for when the order of entries matters. Read this for more information:
http://java.sun.com/docs/books/tutorial/collections/index.html

Similar Messages

  • What is the best way to store and search 2D data

    Hi,
    There is a set of data (~10k records ) in 2D dimension.
    like this :
    Col 1, Col 2, Col3....
    What is the best way to store and search those records ?
    Thanks in advance
    Wilson

    Hi,
    Either userObjet[][] if you know how much data you have, and the data size is fixed, or use a list of lists. E.g. A Vector of Vectors (some will probably say that you should use an ArrayList instead, and that could be the case, but it sounds like you would want to display the data later on, and a DefaultTableModel (for JTables) uses a Vector as data holder).
    Kaj

  • How do you move pictures to an external drive to open space on the Mac hard drive? Or what is the best way to store photos safely?

    How do you move pictures to an external drive to open harddrive space? Or what is the best way to store large photo files? Ive tried copy/cut and paste and it doesnt work. I have nothing on my Mac but photos and its telling me startup disk is too full to download updates.

    Are the photos being stored in iPhoto now?
    How is the external disk formatted?
    Allan

  • What is the best way to scan and sort old photos in iPhoto

    What is the best way to scan and sort old photos in iPhoto?  They do not have digital dates.

    Hey Chicago Sue,
    Once you scan them and have them on your desktop. You should use Automator and assign the common IPTC tags to the images, so that when you do import them into iPhoto, they get recorded.
    Here is an example of an action in Automator:

  • HT1364 I just bought a new PC and now have ample space on my C drive to house my music Library which is currenlty installed on a external drive.  What is the best way to install and move the itunes library to my C Drive?

    I just bought a new PC and now have ample space on my C drive to house my music Library which is currenlty installed on a external drive.  What is the best way to install and move the itunes library to my C Drive?

    If the entire library is on the external drive then simply copy the iTunes folder into <User's Music> on the new computer, then install iTunes. If you've already installed iTunes you will want to remove the empty iTunes folder in <User's Music> first.
    If it turns out you only have the media folder on the external drive then take a look at this post...
    tt2

  • What is the best way to secure and harden a Macbook Pro against unwanted surveillance?

    What is the best way to secure and harden a Macbook Pro against unwanted surveillance? Tor, VPN, Little Snitch, etc. This would be for that latest version of Mavericks.

    djbabybokchoy wrote:
    Nothing specific, just speaking in general. Ex-wives, governments, bad guys...anyone really. I'm just looking to make my Mac a bit more private and secure, especially when on public networks.
    Governments and ex's will/may have recourse to the legal process (or in the case of the Gov they can choose to ignore the legal system if they feel like it) when they want to see something of yours, good luck hardening your Mac against that. The best way to avoid the possibility of snooping over public networks is to avoid them but if you can't then Kappy's suggestion will help.
    Strong passwords (everywhere) and don't use the same password in multiple locations.
    If you really want to secure your home wireless use Mac address connection authentication, do not allow unknown Mac addresses to connect. It's much stronger than a WPA password alone.

  • What is the best way to store a battery?

    Hi,
    I have an extra MBP battery. What is the best way to store this extra battery? Should I store it when it is fully charged? or Should I store it when it is half full? Is it necessary to use that batter once in a while?
    Thank you beforehand.
    Bob

    http://www.apple.com/batteries/notebooks.html
    If you're storing it for a long time, put it away when it's about half full. If you have a couple of batteries for your MacBook, I'd recommend swapping batteries once a month or so to extend the life of both batteries.

  • There are way too many photos on my internal hard drive. I have older libraries, and newer libraires in iPhoto and Aperture 2.  What is the best way to find and reduce the number of duplicate photos/libraries  before upgrading to Aperture 3?

    There are way too many photos on my internal hard drive. I have older libraries, and newer libraires in iPhoto and Aperture 2.  What is the best way to find and reduce the number of duplicate photos/libraries  before upgrading to Aperture 3?

    Sharon-
    Good idea.
    Back up first.
    I would probably wait for the merge function of the latest version before merging. Be sure to verify every merge.
    Merge Libraries, then from within Aperture move images to referenced on external hard drives.
    HTH
    -Allen

  • What's the best way to store my info externally

    I have recently bought my first Macbook Pro 13" with 2.4 Ghz. I am currently using it for my own business and do tend to get a lot of files together. I went to look at "About this Mac" and have already got 369 Gb used up in storage... I have no idea how I have done that as I have hardly downloaded any apps on this computer besides the ones that were on here. I did download Vware Fusion 4 as I have a reservation system which I used to run on my pc and need to have this on here too so perhaps that software takes a lot of space.
    Could anyone advise on which is the best way to store my info externally, will any external harddrive do, or do you need a special one for Apple or Macbook pro. I am just asking as I have no idea and prefer to buy the right one straight away.
    Any help would be much appreciated !
    Thanks, Sara***

    Sara,
    The most reliable method is to use an external hard drive.  Some are better than others, but most will work.
    For the least amount of setup pain, I prefer to deal with the Mac specialists at OWC, http://www.macsales.com as they stand behind their products with great warranty and support.  I have one of their Mercury Elite Pro 2 TB drives that has multiple interface capability so you can get a fast interface for data transfer.
    Take a look at what they offer and see what fits your needs.  If you have more questions about doing thin, just ask on here.
    Ralph

  • What's the best way to store old FCP projects & media?

    Hey
    I've started to accumulate more and more video content of client projects, but I don't want to delete it in case they come back a year later looking for an update on the video product I made them.
    So, what's he best way to store FCP projects and video files?
    I thought maybe a BluRay burner might do the trick.
    Any suggestions?
    Sam

    Since you're using RAW files you might peruse the DAM Forum to learn about possible other DAM (digital asset management) software and workflows. There is a wealth of information at that site.
    I useMedia Expression for my primary DAM application and iPhoto for special projects like books, calendars, etc.

  • What is the best way to store videos using Macbook Air?

    I have a Macbook Air and I don't want to store videos on the hardrive because it will fill up fast.  I have a lot of videos - for people that also take a lot of videos - what is the best way in your opinion or best place to store video? For example, on a server, on a cloud server, etc?

    Ok, so do you have a recommend brand and space capacity?
    You mentioned that one of your primary needs is to store video, which demands large capacity. As a consequence I'd suggest a drive with at least 1Tb, perhaps greater, capacity. I don't have a preferred brand or manufacturer - it's a bit like recommending which is better between Ford and Chevy - but I have a couple of Western Digital external USB drives which have proven very reliable, and a Seagate which is used as a daily backup and has worked flawlessly.
    DWB's point about backups is important too, because when you store files on any drive there is a risk of that drive failing - and indeed, all drives will fail at some point. The question is, can you live with the total loss of those files if the drive does fail? If you are storing files that you value, then a backup is needed to help protect those files. Ideally that would mean two drives, not one. One to use for the storing the files, and the second to use to back those files up.

  • What is the best way to read and manipulate large data in excel files and show them in Sharepoint

    Hi ,
    I have a large excel file that has 700,000 records in it. The excel file has a few columns that change every day.
    What is the best way to read the data form the excel file in fastest and most efficient way.
    2 nd Problem,
    I have one excel file that has many rows each row contain some data that has certain keywords.
    What I want is  to segregate the data of rows into respective sheets(tabs ) in the workbook.
    for example in rows have following data 
    1. Alfa
    2beta
    3 gama
    4beta
    5gama
    6gama
    7alfa
    in excel
    I want there to be 3 tabs now with each of the key words alfa beta and gamma.

    Hi,
    I don't really see any better options for SharePoint. SharePoint use other production called 'Office Web App' to allow users to view/edit Microsoft Office documents (word, excel etc.). But the web version of excel doesn't support that much records as well
    as there's size limitations (probably the default max size is 10MB).
    Regarding second problem, I think you need some custom solutions (like a SharePoint timer job/webpart ) to read and present data.
    However, if you can reduce the excel file records to something near 16k (which is supported rows in web version of excel) then you can use SharePoint Excel service to refresh data automatically in the excel file in SharePoint from some external sources.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • What is the best way to import and edit a large amount of footage?

    Hello Apple world,
    As a newbie to Final Cut 10 I have a question regarding best ways to import footage. I'll give you a quick run down.
    I have a 150 gig of gopro footage that I just hit 'import' to recently (from my external HD), it took around 10 hours to process it all.
    Its all under one event, but then somewhat organised into dates etc. But it is very slow. I imported it all at once because it was all footage from the last 6 months of my Whistler/states/fiji trip and want to make a movie out of it, using clips from all over the time, not just in chronological order.
    I have the latest mac book pro, 4 gig ram,2.4 GHz i7, 750 hard drive, with nothing else on the computer.
    Ive read about creating proxy media, after ive imported, but am still somewhat confused as to the benefit. Does it create duplicates? that will fill up my pretty large HD as it is!
    Can you suggest any ways that might make my laptop run a bit faster? Should i delete and work directly from external HD etc etc?
    Any suggestions will be greatly appreciated!
    Thanks in advance
    Harlee

    ascreenwriter wrote:
    Hello,
    I've just finished shooting what I am considering to be my directorial masterpiece.  Shot it on the Canon 5D (1080p, 24fps), and the footage looks amazing.  Now I am ready to start editing and have been using premiere lately, but I have yet to figure out the proper pipeline.  I want to know the best way to retain resolution before I delve into this project.
    My questions:
    1)  What is the best way to start a new project and import the footage without having to render whilst editing, so as to retain all resolution and originality of the source footage?
    2)  What is the best way/ codec/ format to export this same footage once editing is complete so as to retain that crisp 1080p for which the 5D is so recognized?
    3)  What is the best way/ codec/ format to import and export/ render between premiere and after effects?  I am speaking mostly of vfx and color correction.  I also have some 30fps footage that I intend to slow down in AE and then import into premiere.
    I know this is pretty broad, but as a solo filmmaker I really need someone's guidance.  I rarely ever finish my films with the same, crisp look as the footage.  I need pipeline help, and really appreciate it!
    1. Follow the advice above. Also use the Media Browser to import the footage in case you have spanned media files. Import files with the Media Browser.
    2. It largely depends on what you wish to ouput to: Blu-ray, web, etc. This FAQ gives the best answer: What are the best export settings?
    3. Use the Replace with Adobe After Effects Composition function.

  • What is the best way to import and export footage from the 5D Mark II?

    Hello,
    I've just finished shooting what I am considering to be my directorial masterpiece.  Shot it on the Canon 5D (1080p, 24fps), and the footage looks amazing.  Now I am ready to start editing and have been using premiere lately, but I have yet to figure out the proper pipeline.  I want to know the best way to retain resolution before I delve into this project.
    My questions:
    1)  What is the best way to start a new project and import the footage without having to render whilst editing, so as to retain all resolution and originality of the source footage?
    2)  What is the best way/ codec/ format to export this same footage once editing is complete so as to retain that crisp 1080p for which the 5D is so recognized?
    3)  What is the best way/ codec/ format to import and export/ render between premiere and after effects?  I am speaking mostly of vfx and color correction.  I also have some 30fps footage that I intend to slow down in AE and then import into premiere.
    I know this is pretty broad, but as a solo filmmaker I really need someone's guidance.  I rarely ever finish my films with the same, crisp look as the footage.  I need pipeline help, and really appreciate it!

    ascreenwriter wrote:
    Hello,
    I've just finished shooting what I am considering to be my directorial masterpiece.  Shot it on the Canon 5D (1080p, 24fps), and the footage looks amazing.  Now I am ready to start editing and have been using premiere lately, but I have yet to figure out the proper pipeline.  I want to know the best way to retain resolution before I delve into this project.
    My questions:
    1)  What is the best way to start a new project and import the footage without having to render whilst editing, so as to retain all resolution and originality of the source footage?
    2)  What is the best way/ codec/ format to export this same footage once editing is complete so as to retain that crisp 1080p for which the 5D is so recognized?
    3)  What is the best way/ codec/ format to import and export/ render between premiere and after effects?  I am speaking mostly of vfx and color correction.  I also have some 30fps footage that I intend to slow down in AE and then import into premiere.
    I know this is pretty broad, but as a solo filmmaker I really need someone's guidance.  I rarely ever finish my films with the same, crisp look as the footage.  I need pipeline help, and really appreciate it!
    1. Follow the advice above. Also use the Media Browser to import the footage in case you have spanned media files. Import files with the Media Browser.
    2. It largely depends on what you wish to ouput to: Blu-ray, web, etc. This FAQ gives the best answer: What are the best export settings?
    3. Use the Replace with Adobe After Effects Composition function.

  • What is the best way to encode and compress?

    I just finished an hour and a half long video of comedians performing. The client wants this to be put on dvd so he can mass produce it. What is the best way to compress this and encode it? Should I buy compressor or can I do it in handbrake? What are the best best settings to make sure it doesnt lose quality? Please advise...

    You should be able to get up to 2 hours at least.
    The best way is to export as a Master File and drop it into iDVD, Toast or some other DVD authoring app.

Maybe you are looking for

  • I am still trying to get two funtions to run AT THE SAME TIME within my vi, but to no avail.

    I am trying to capture a signal with a daq card (PCI-MIO-16E-4) WHILE I have a picture box switch back and forth between grey levels. It is absolutely necessary that they both happen simultaneously, but what is happening is that the picture box stops

  • Wrong Last Active Time-stamp (Ref: TA-21165)

    Status: Investigating Affects: Some Users Description:  Some members have recently reported seeing a discrepancy between Last Active Timestamp on Pets and on Profile. We've verified this issue with engineers and they're working to get the problem res

  • Expected date for Jdeveloper 11g production version

    i am planning to start development with jdeveloper (Forms 6i background). but with latest version. If you can help me out of dates of jdeveloper 11g production release. it will save my troubleshooting time. Also help me out some starting point to be

  • Conversion to WMV file

    Is it possible to convert MOV file to WMV file? If so, what is the best way/ application would recommend?

  • Still connecting... in iPhoto 5.0.4 to order book

    I have the not uncommon problem of trying to order a book...the book pages load; I get the "connecting" blue and white barber shop bar...and it never happens. I tried asking support, and they told me to try a hard line instead of wireless--nothing. T