To find highest occurecnce of word in a any text file
hi
i have to submit this program to tomarrow morning in a company.this is part of technical round.so pls give suggestions how to write.if possible send code
ok
That could sound like cheating.
Why don't you give us your answer and we will give you feedback on what to say/not to say.
Similar Messages
-
How can I find out the number of lines in a text file?
How can I find out the number of lines in a text file?
java.io.BufferedReader in = new java.io.BufferedReader( new java.io.FileReader( "YourFile.txt" ) );
int lineCount = 0;
while( in.readLine() != null )
lineCount ++;
System.out.println( "Line Count = " + lineCount ); -
Finding and Changing "first word character syle" in text
I want to search spesific word and only replacing first founded word character style in text. Like this :
"Transfer to Istanbul Airport for morning flight to Adana. Meet and transfer to Antioch , the place where the followers of Jesus were first called Christians. Here you will visit the Church of St. Peter, a grotto discovered by the Crusaders and reputed to be the cave church where early Christians met in secret. At the Mosaic Museum in Antioch you will see an unusually rich collection of mosaics from this area. Following your visit at the museum, you will go to the Seleucia Pieria, the ancient port town of Antioch from which Paul and Barnabas set out on their first journey and where Paul returned afterwards. Finaly, you will check into the hotel in Antioch for dinner and overnight. (B,D)"
This paragraph contains 4 Antioch word. And I want to make BOLD first one.
This is my code but this code change all of them to bold. Can anyone help me?
var myDocument = app.documents.item(0);
// Clear old preferences
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
//Set the find options.
app.findChangeTextOptions.caseSensitive = false;
app.findChangeTextOptions.includeFootnotes = false;
app.findChangeTextOptions.includeHiddenLayers = false;
app.findChangeTextOptions.includeLockedLayersForFind = false;
app.findChangeTextOptions.includeLockedStoriesForFind = false;
app.findChangeTextOptions.includeMasterPages = false;
app.findChangeTextOptions.wholeWord = false;
// This CharacterStyle set to BOLD FONT STYLE
app.changeTextPreferences.appliedCharacterStyle = myCharacterStyle;
app.findTextPreferences.findWhat = "Antioch";
app.changeTextPreferences.changeTo = "Antioch";
myDocument.changeText();@cuneytoral – the explanation is:
findText() ( or findGrep() ) are methods that return an array of found texts (formatted text objects).
So the result with index 0 is the first one found. The last one is the length of the array -1.
Since the result is of type Array and not Collection, we cannot define a range with the itemByRange() method.
And also we cannot define the last item as allFoundItems[-1], but to have write this:
allFoundItems[allFoundItems.length-1].appliedCharacterStyle = myCharacterStyle;
to address the last found one.
Say, we want to format the found texts from the second one found to the last one found, we have to loop through the found array:
We do not start the loop with 0, but with 1:
for(var n=1;n<allFoundItems.length;n++){
allFoundItems[n].appliedCharacterStyle = myCharacterStyle;
Formatting every other of the found texts would be:
for(var n=0;n<allFoundItems.length;n=n+2){
allFoundItems[n].appliedCharacterStyle = myCharacterStyle;
Just to give you some ideas…
Uwe -
Extract words from JSP into text file
Hi,
I have a big problem:
I want to extract selected words from a jsp file.
Following are found in one of my jsp file:
E.g.
1) <td width="217"><font face="verdana,arial" size=2>ORGANISATION UNIT NAME<font color="#FF0000"> <font
id="fontMandatory">*</font></font>
I want to retrieve "ORGANISATION UNIT NAME"
2)errPrompt(frm.txtDesc, "Maximum length is just 100 character only");
I want to retrieve "Maximum length is just 100 character only"
I try String tokenising, then check that is the token ends with ">", then the next token is the one
I want, then loop until "<" is found. BUT this would not work as there is no spacing between some of
the tags and the words.(e.g. <p>abc)--> This cauese the whole token to be <p>abc, so the "abc" will
not be extracted as it does not have a "ends with >" in front of it.
Even with using ">" as a checking does not work for pop up messages, as it does not have tags(refer
to e.g 2).
Please reply a.s.a.p...
Really urgent!!
Thank You
Michellefor extracting the HTML tags, u can use DOM/DHTML
I dont remember the syntxes, how to use, but i know that it is possible, just go thru' the DOM/DHTML
Regards,
Ritesh -
How to find SVG coordinates which have been converted to text file?
Hi all,
I am currently developing a system that will read svg file. As svg file can be converted to text file, i already converted it. The problem is how is i going to read the coordinates provided by svg?I just want to read all the coordinates, nothing else...I hope you all can help.
Regards..
Edited by: Tommy1986 on Jul 8, 2008 12:45 AM
Edited by: Tommy1986 on Jul 8, 2008 12:47 AM<?xml version="1.0" standalone="no"?>
<svg width="6.666667in" height="4.166667in" viewBox="-0.000000 -0.000000 6.666667 4.166667">
<g transform="matrix(1,0,0,-1,0,4.166667)">
<polyline id="1" stroke="#000000" stroke-width="0.007874" fill="none" points="1.218750,2.614583 1.239583,2.666667 1.364583,2.791667 1.395833,2.885417 " />
<polyline id="2" stroke="#000000" stroke-width="0.007874" fill="none" points="1.656250,2.802083 1.364583,2.802083 1.322917,2.541667 1.296875,2.489583 1.296875,2.364583 1.406250,2.260417 1.468750,2.244792 1.875000,2.244792 " />
<path id="3" d=" M1.887762,2.247006 A0.531129,0.531129 0 0,1 1.657914,2.815088 " fill="none" stroke="#000000" stroke-width="0.007874" />
</g>
</svg>
Hi BatraAnkit,
Thank you very much for replying in my post. I really appreciate it Above is an example of svg file. What I am tring to do is to read only the polyline and the path collumn. Is there anyway to do it? As you can see, the svg is in xml format. Looking forwards to your reply..
Regards,
Tommy1986 -
Find Change through external text file
Hello folks
I am bit pretty in InDesign scripting so could you please look into this.
How can i change any particular text field in Indesign CS3 document from text file.
I do have find change script but for each InDesign document specific text file is assigned.
So each time i have to modify find change GREP property that is also repetetive of work. Is there any way to get find change information should be extract from external text file.
Many Tanks in advanceIn the FindChangeByList script, you could customize the function myFindFile(myFilePath) {...} as to search the FindChangeList text file in the document location rather than the script location. That's an example. The question is: given a document, where will you have the corresponding FindChangeList?
@+
Marc -
Cannot copy and paste text in word,excel or text file
Cannot copy and paste in word,excel or in text file. It get paste in special charector.
Eg.
( )* +
( )* +Yesterday i update Yosemite and Adobe Photoshop CS6
i found error text message like you everytime when i used fontAwesome on Adobe Photoshop CS6 and then i found out to fix this problems Yeahh…
Try My Way to fix it out
-> copy The Text you want to use
-> paste your text (from your clipboard) To App TextEdit
-> then Copy again
-> back to Photoshop paste it on your document layout
-> Done -
Find exact word in text file tht is present in an excel sheet
Hi all,
i want to find words in an text file.
but the criteria is i want to search words which r already listed in another excel sheet and change the color of these word.
i used FileInputStream
and also BufferedInputStream
cany anyone help me with thishi kajbj,
can u plz tell me how to do in VBA then
will find out the way to do in java
Thanx -
How do I find and replace a word in PDF?
How do I find and replace a word in PDF?
In the Find window (Ctrl+F) there's an option to replace the searched text.
This is in Acrobat XI, and there's no Replace All-function.
On Thu, Jan 15, 2015 at 4:27 PM, claireb88184899 <[email protected]> -
Did I miss something in the fine print? I installed Lion and and come to find out, I can no longer open any Word documents or Excel spreadsheets as they are no longer supported (apparently because they are PowerPC apps). Seriously?!?!?!?!! What are my alternatives?
Hi Mary and Matthew
You might find it helpful to "try before you buy" - there is a 30 day free trial offer for Office for Mac 2011, accessible from M's .com website.
You may be able to use this period to open and resave your old documents in a format that enables you to switch instead to using Apple's iWorks apps moving forward.
I initially intended to do something similar, but ended up buying Office as it provided an easier way (for me, at least) to continue working with years worth of old emails, letters, spreadsheets and other documents (from my PC days) without risking damage to their integrity, formatting, etc. -
How to find out the stop words of an index?
I am sure it's something very easy but:
I want to find out the stop words that i am using in a particular index via SQL query?
I had several indexes with diferent stoplists.
ThanksI already found out.
thanks.
for anyone also looking see
select * from ctx_stopwords; -
How to find the ocuurence of a word from LIST A in LIST B in a text file?
Hey if you look at the text file there is LIST A and LIST B.. i need to find the ocuurence of a word from LIST A in LIST B. Eg: if my output is (1,3)
then first word from LIST A occurs in 3 places in LIST B.
Can you please get the sample code to do this process.
Please let me know..
My text file looks like this below :
phrases.txt
LIST A
aamsz
abaffiliate
aboard casino
above computer
above pop
above violat
LIST B
http://209.153.231.131
HTTP/1.0 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 02 Feb 2004 11:53:26 GMT
IISExport: This web site was exported using IIS Export v2.2
IISExport: This web site was exported using IIS Export v2.2
Content-Length: 274
Content-Type: text/html
Set-Cookie: ASPSESSIONIDSSDBBBAR=OOGFKOJBMKMDCGPIHPADALHB; path=/
aboard casino
Cache-control: private
abaffiliate
above computerThe key difference is that Vector is synchronized whilst ArrayList is not. Synchronized means that the classes methods can safely be accessed by different threads and as your application will not be multithreaded then the ArrayList is possibly the better option.
To store Strings in an ArrayList, you first need to declare the ArrayList object something like this;
ArrayList<String> listAList = new ArrayList<String>();and you would obviously do something similar for the ArrayList that will hold the Strings that should belong to List B.
The first thing to note is that you can use the new (well new in version 1.5 anyway) generics techniques to specify the type of the object the ArrayList will hold; Strings in this case.
To add a value into the ArrayList once you have read it from the file and decided if it belongs in the List A or List B ArrayList, all you need to do is call the add() method of the ArrayList something like this;
// Assume that you read the line from the file into a variable called temp;
listAList.add(temp);To compare the two lists, the easiest option would be to iterate through one ArrayList and ceheck to see if the values you recover from it are duplicated in the other ArrayList. Luckilly, ArrayList has another method that helps here, it is called contains();
Assuming that you have two ArrayList(s), one called listAList that holds the Strings that belong to List A and another called listBList that holds the Strings that belong to ListB, you could do something like this to check for duplicates;
for(String element : listAList) {
if(listBList.contains(element)) {
System.out.println("Found a match");
}Hope that helps. -
I have my Mac with Mountain Lion and my IPad synched and have Pages on both. I have doc in Word on my Mac I want to access on my IPad while I am away travelling. But I can't locate them. Where should I look to find my previously saved Word docs?
Welcome to the Apple Support Communities
It looks like you haven't got them on iCloud. On your Mac, open Pages and drag the Word documents to the iCloud window -
[AS] Find a string of words in text
Hello - hopefully someone can help as I'm now stuck on this. I want to be able to find a specific string of words within a text frame, though I want to be able to do this without using the Find Text Preferences approach.
I can get it to work if i am just finding one word, but if there is more than one word it doesn't work.
For example this works (given a text frame with text in that contains the word Example):
tell application "Adobe Indesign CS5"
tell active document
set mybox to selected
tell mybox
set myfind to object reference of every word whose contents = "Example"
end tell
end tell
end tell
However the same does not work (searching for "The Example", which is two words)
tell application "Adobe Indesign CS5"
tell active document
set mybox to selected
tell mybox
set myfind to object reference of every word whose contents = "The Example"
end tell
end tell
end tell
What i can't figure out is the correct phrasing for finding a string of words, i guess i should not be looking for the object reference of WORD, but nothing else i've tried seems to work. Many thanks for any helpI think what John has said is correct… I only had a quick look in the dictionary terms. Without find/change the closest you may get is line or paragraph after that you would need to manipulate the line/para contents further… Word by definition I would think can't contain space but is encapsulated in space bar first/last…
tell application "Adobe InDesign CS5"
tell active document
tell story 1
set myfind to object reference of every word whose contents = "Example"
end tell
show text first item of myfind
end tell
end tell
This would show the line you can then break down further…
tell application "Adobe InDesign CS5"
tell active document
tell story 1
set myfind to object reference of every line whose contents contains "For Example"
end tell
show text first item of myfind
end tell
end tell -
I've recently downloaded Lion and find my Microsoft excel, word, entourage and powerpoint do not function. It says these functions are not now supported. Why and how do I get to use them again?
philippnoe wrote:
What a "great" Program which is supporting many nice but not mandatory things but is not supporting a Program which is used day by day from many users ... and especially this Program is also sold officially by apple !!!
Yeah!, Why, Lion won't even run my old DOS programs!
Maybe you are looking for
-
How to ignore white space when parse xml document using xerces 2.4.0
When I run the program with the xml given below the following error comes. Problem parsing the file.java.lang.NullPointerExceptionjava.lang.NullPointerExce ption at SchemaTest.main(SchemaTest.java:25) =================================================
-
Unable to create the confirmation
Hello We are not able to create the confirmation for PO. We are not finding the PO while trying to create confirmation using confirm centrally transaction. Please reply how the conf can be created? Thanks Manas
-
Print Date located in Special Fields In Field Explorer
Post Author: sher CA Forum: General The "print date" on my report displays the first date I ran the report which was 6/11/07. This date should display the system date/current date. Do you know why this is happening in my report?
-
My iPad 2 in the last two days has been very slow, in reaction time, and hangs. I have attempted to restart two to three times, to no avail. Should I erase all content and reload the apps and other content??
-
FF14.5 says it's not compatible with the Kaersky virtual keyboard and the URL adviser. I think the URL adviser is part of the anti virus. I have chose to stay with 12.0 because of these notices? thanks.