vinnyMS Posted April 22, 2021 Author Share Posted April 22, 2021 Around 500 words, it's a 22k lines file the text to find sentences from Link to comment Share on other sites More sharing options...
JockoDundee Posted April 22, 2021 Share Posted April 22, 2021 Ok, but in that case wouldn’t you want the 3 matches to be grouped together? Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
vinnyMS Posted April 22, 2021 Author Share Posted April 22, 2021 Yes by order Link to comment Share on other sites More sharing options...
JockoDundee Posted April 22, 2021 Share Posted April 22, 2021 But when I asked: Quote 1) if one sentence has two different matching words in it, should the sentence appear just once? you replied: Quote just once which means that a sentence with two or more matching words will only appear once, when it matches the first word. the sentence won’t appear later when showing the other matches. therefore, and pretty much randomly, one or more of the three matches will not be grouped with the others when there are sentences with multiple matches. this doesn’t make sense, why not just show all matches (max 3) together, even if it means having the matching sentence duplicated. Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
vinnyMS Posted April 22, 2021 Author Share Posted April 22, 2021 (edited) you could make it pick sentences randomly, from line 1 to line 22k. sentences have to be unique (result file). the order is the word list order i will count three times (lines) for each word, it's not a problem Edited April 22, 2021 by vinnyMS Link to comment Share on other sites More sharing options...
JockoDundee Posted April 22, 2021 Share Posted April 22, 2021 18 minutes ago, vinnyMS said: sentences have to be unique (result file). right, but why? If I’m looking at words used in their context, why I am bothered that a sentence appears on line 100 when it matches with word “Abacus” and then 1000 lines later because it also contains the word “zoo” ? whose requirement is this uniqueness? Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
vinnyMS Posted April 22, 2021 Author Share Posted April 22, 2021 uniqueness because i study at least 3 variants of word use. to have more variety to understand the use of the words as in different context Link to comment Share on other sites More sharing options...
JockoDundee Posted April 22, 2021 Share Posted April 22, 2021 39 minutes ago, vinnyMS said: to have more variety to understand the use of the words as in different context even if a sentence is duplicated, each word still has three different contexts, so no less variety of word contexts. Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
vinnyMS Posted April 22, 2021 Author Share Posted April 22, 2021 very good so can you create it? Link to comment Share on other sites More sharing options...
vinnyMS Posted April 28, 2021 Author Share Posted April 28, 2021 Help plz Ty Link to comment Share on other sites More sharing options...
JockoDundee Posted April 28, 2021 Share Posted April 28, 2021 Local $sentences=".!? " & StringRegExpReplace(FileRead("2.txt"), "([\!\.\?])", "$1.!?") FileDelete("results.txt") For $word In StringSplit(FileRead("1.txt"), @CRLF, 3) FileWriteLine("results.txt",@CRLF & "WORD: "& $word) $iEPos=1 For $n = 1 to 3 $iWPos=StringInStr($sentences, $word, 0, 1, $iEpos) If $iWPos=0 Then ExitLoop $iSPos=StringInStr($sentences, ".!?", 0, -1, $iwPos) $iEPos=StringInStr($sentences, ".!?", 0, 1, $iwPos) $sentence=StringStripWS(StringMid($sentences, $iSPos + 3, $iEPos - $iSpos - 3),3) FileWriteLine("results.txt", $sentence) Next Next IMHO, you deserve an A+. vinnyMS and TheDcoder 1 1 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
Nine Posted April 28, 2021 Share Posted April 28, 2021 5 hours ago, JockoDundee said: IMHO, you deserve an A+. I would have truly appreciated you as a teacher in those days... JockoDundee and TheDcoder 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
vinnyMS Posted April 28, 2021 Author Share Posted April 28, 2021 when i try to extract sentences with the word "networks" the program extracts extra text WORD: networks Networks and network protocols History of TCP/IP Important features of TCP/IP Transmission Control Protocol/Internet Protocol (TCP/IP) is a protocol system—a collection of protocols that supports network communications. This hour describes what a network is and shows why networks need protocols. Networks and Protocols A network is a collection of computers or computer-like devices that can communicate across a common transmission medium. Link to comment Share on other sites More sharing options...
JockoDundee Posted April 28, 2021 Share Posted April 28, 2021 1 minute ago, vinnyMS said: when i try to extract sentences with the word "networks" the program extracts extra text give me your input files or no dice Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
JockoDundee Posted April 28, 2021 Share Posted April 28, 2021 It’s because there is no period after Networks and Protocols so it’s all one long sentence. Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
JockoDundee Posted April 28, 2021 Share Posted April 28, 2021 Local $sentences=".!? " & StringRegExpReplace(FileRead("2.txt"), "([\!\.\?][' '])", "$1.!?") $sentences=StringRegExpReplace($sentences, "([\n][\n])", ".!?") FileDelete("results.txt") For $word In StringSplit(FileRead("1.txt"), @CRLF, 3) FileWriteLine("results.txt",@CRLF & "WORD: "& $word) $iEPos=1 For $n = 1 to 3 $iWPos=StringInStr($sentences, $word, 0, 1, $iEpos) If $iWPos=0 Then ExitLoop $iSPos=StringInStr($sentences, ".!?", 0, -1, $iwPos) $iEPos=StringInStr($sentences, ".!?", 0, 1, $iwPos) $sentence=StringStripWS(StringMid($sentences, $iSPos + 3, $iEPos - $iSpos - 3),3) FileWriteLine("results.txt", $sentence) Next Next dice. vinnyMS 1 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
vinnyMS Posted April 29, 2021 Author Share Posted April 29, 2021 doesn't seem to work 1.txt 2.txt results.txt Link to comment Share on other sites More sharing options...
JockoDundee Posted April 29, 2021 Share Posted April 29, 2021 1 hour ago, vinnyMS said: doesn't seem to work sorry about that... Im almost done with the fix, just another minute or to... Why don't you take this time to go back and upvote all the people who tried to help you in this thread, myself excluded? Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
Nine Posted April 29, 2021 Share Posted April 29, 2021 2 minutes ago, JockoDundee said: just another minute or to... Is it because english is not your favorite matter ? minute or two ? JockoDundee 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
JockoDundee Posted April 29, 2021 Share Posted April 29, 2021 1 minute ago, Nine said: Is it because english is not your favorite matter ? minute or two ? I can't believe you're still holding a grudge about the an hybrid thing Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now