Results 1 to 11 of 11
Thread: pattern matching with two arrays
- 11-24-2010, 01:26 PM #1
Member
- Join Date
- Nov 2010
- Posts
- 29
- Rep Power
- 0
pattern matching with two arrays
hi,
i have an issue with comparing two array lists. array a1 has the content of a set of 500 articles. array a2 has a set of noun phrases.
i need to check each element of a2 with each element of a1.
because i want to check in how many articles does the elements of a2(noun phrases) occur.
pls help...
regards
jessie
- 11-24-2010, 01:57 PM #2
How To Ask Questions The Smart Way
What is your issue? What have you tried? Where are you stuck? Be specific.
- 11-24-2010, 02:00 PM #3
Member
- Join Date
- Nov 2010
- Posts
- 29
- Rep Power
- 0
hi,
i can't find a way of counting the number of articles that the noun phrases occur. i have 500 articles in a list. i need this to know the document frequnecy of a noun phrase.. im new to java..pls help..
- 11-24-2010, 02:10 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,373
- Blog Entries
- 7
- Rep Power
- 17
- 11-24-2010, 02:48 PM #5
Member
- Join Date
- Nov 2010
- Posts
- 29
- Rep Power
- 0
thanks..but i have a code like this.
can u tell me how i can get the count of articles in which the noun phrases occur? content1 has the text of articles and laststring has the noun phrases.Java Code:int counti=0; for (int i=0;i<laststring.size();i++) { for (int j=0;j<content1.size(); j++) { if(content1.get(j).contains(laststring.get(i))){ //System.out.println("equals..:"+laststring.get(i)); } } }
- 11-24-2010, 02:50 PM #6
How would you do this with just one article text String and one noun phrase?
- 11-24-2010, 02:55 PM #7
Member
- Join Date
- Nov 2010
- Posts
- 29
- Rep Power
- 0
if the noun phrase appears in the article the count would be one, bcos im getting only the article count..
- 11-24-2010, 02:57 PM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,373
- Blog Entries
- 7
- Rep Power
- 17
What Kevin says; I hate it when someone tries to 'knit' his code together and crafts long lists of code, zigzag-ing all over the pages, containing loops, conditional statements and, oh shudder, legions of boolean flags, only to end up giving an incorrect answer. I don't want to dig through such jungles. Use a lot of small simple, self contained methods instead.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 11-24-2010, 03:04 PM #9
Huh? I don't think that's what I asked. Forget your assignment for a second.
Pretend you have one String that contains some text, and another String that contains a word to search for in that text. How would you count the number of times the word appears in the text?
Write a method that does that, and we'll go from there.
- 11-24-2010, 03:48 PM #10
Member
- Join Date
- Nov 2010
- Posts
- 29
- Rep Power
- 0
Java Code:String text= "Unions representing Health Service Executive staff have voiced disappointment at progress made at today's talks on controversial proposals to shed 5,000 jobs at the agency by the end of the year." String searchtext = "Health" int count =0; if(text.contains(searchtext)){ count++; } System.out.println(count);
- 11-24-2010, 04:00 PM #11
Similar Threads
-
myPatterns: pattern matching in custom notations for Java & JavaScript
By Nic Volanschi in forum Java SoftwareReplies: 0Last Post: 06-29-2010, 08:16 PM -
String matching a pattern
By vividcooper in forum New To JavaReplies: 7Last Post: 01-07-2010, 10:30 PM -
Will someone pliz help me with this code on pattern matching
By nmvictor in forum New To JavaReplies: 1Last Post: 10-27-2009, 07:33 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks