Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Read text.?? Google Search??

brutallicabrutallica Posts: 20Member
Hi,

My plagiarism detector program needs to convert a MSWord document into a text file and then read the texts in the text file. I've done the converting part already and now my problem is I wanna know how I can have my program pick up a text file from a folder and read it...and then after it has finished reading the text, it goes to the next text file in the folder and repeat the process of reading, and this goes on until it has finished reading all the text files from the folder.

Also, as my program reads the texts in the text files, it'll need to search for the phrases, for example a 2-word phrase, on google. I've decided to do this by searching using a google search URL like, http://www.google.com/search?q=Hello+world, and then downloading the relevant Google search results with URLDownloadToFile (I also have written this part already), and parse the results as a string. My problem here is that I dont know how to write the google search URL part, like I have problems inserting the text read into the query part of the Google search URL.

So, that's my problem...and I hope someone would be able to help me out.

Comments

  • GenjuroGenjuro Posts: 913Member
    : Hi,
    :
    : My plagiarism detector program needs to convert a MSWord document into a text file and then read the texts in the text file. I've done the converting part already and now my problem is I wanna know how I can have my program pick up a text file from a folder and read it...and then after it has finished reading the text, it goes to the next text file in the folder and repeat the process of reading, and this goes on until it has finished reading all the text files from the folder.
    :
    : Also, as my program reads the texts in the text files, it'll need to search for the phrases, for example a 2-word phrase, on google. I've decided to do this by searching using a google search URL like, http://www.google.com/search?q=Hello+world, and then downloading the relevant Google search results with URLDownloadToFile (I also have written this part already), and parse the results as a string. My problem here is that I dont know how to write the google search URL part, like I have problems inserting the text read into the query part of the Google search URL.
    :
    : So, that's my problem...and I hope someone would be able to help me out.
    :

    As for text files, given that I'm leaving Unicode support to you (have a nice time with it if you need it *grin*), reading from a text file is easy: check out Open, Line Input, EOF, and Close on MSDN. Perhaps FreeFile also.
    It works like that:

    'Open' a file for input
    until EOF (end of file) 'input line's one at a time into a string
    'Close' the file when you're done with it.

    As for google search, it's even easier, since this code snippet :
    [code]
    Dim StrSearchString as string
    Dim Word1 as string
    Dim Word2 as string

    Word1 = "Hello"
    Word2 = "world"

    StrSearchString = "http://www.google.com/search?q=" & Word1 & "+" & Word2

    [/code]

    creates an url to a google search, based on Word1 and Word2 variables.
  • brutallicabrutallica Posts: 20Member
    : : Hi,
    : :
    : : My plagiarism detector program needs to convert a MSWord document into a text file and then read the texts in the text file. I've done the converting part already and now my problem is I wanna know how I can have my program pick up a text file from a folder and read it...and then after it has finished reading the text, it goes to the next text file in the folder and repeat the process of reading, and this goes on until it has finished reading all the text files from the folder.
    : :
    : : Also, as my program reads the texts in the text files, it'll need to search for the phrases, for example a 2-word phrase, on google. I've decided to do this by searching using a google search URL like, http://www.google.com/search?q=Hello+world, and then downloading the relevant Google search results with URLDownloadToFile (I also have written this part already), and parse the results as a string. My problem here is that I dont know how to write the google search URL part, like I have problems inserting the text read into the query part of the Google search URL.
    : :
    : : So, that's my problem...and I hope someone would be able to help me out.
    : :
    :
    : As for text files, given that I'm leaving Unicode support to you (have a nice time with it if you need it *grin*), reading from a text file is easy: check out Open, Line Input, EOF, and Close on MSDN. Perhaps FreeFile also.
    : It works like that:
    :
    : 'Open' a file for input
    : until EOF (end of file) 'input line's one at a time into a string
    : 'Close' the file when you're done with it.
    :
    : As for google search, it's even easier, since this code snippet :
    : [code]
    : Dim StrSearchString as string
    : Dim Word1 as string
    : Dim Word2 as string
    :
    : Word1 = "Hello"
    : Word2 = "world"
    :
    : StrSearchString = "http://www.google.com/search?q=" & Word1 & "+" & Word2
    :
    : [/code]
    :
    : creates an url to a google search, based on Word1 and Word2 variables.
    :

    Thank you very much :) I'll try it out on my program.
Sign In or Register to comment.