Searching Text Using Tab Delimited TXT file dictionary

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
saratogacoach
Posts: 87
Joined: Thu Jul 17, 2008 8:42 pm

Searching Text Using Tab Delimited TXT file dictionary

Post by saratogacoach » Wed Jun 10, 2009 10:13 pm

Hi,

This may not be a good starting project for a beginner, so I thought it would be wise to check.

I can write up a small text file (.txt) that is tab delimited, with a numbered list of word categories (for example, 1=noun, 2=verb, 3=adjective, etc.) and another longer list of common nouns, verbs, adjectives, etc. that the dictionary is screening a block (string) of text for.

New to RunRev, I looked at the RunRev distionary and found matchText and suspect it may be involved in this task?

The block of text would be cut/pasted or dragged by the user into a text entry field, which I think would need to be scripted to write these words as a string into a variable (array?).

Then, once the user, for example clicks a button called "analyze" coded to open the dictionary, read its tab delimited content, analyze the words in the string array for matches in the dictionary and finally report the number of words matched for each word category.

So, for example, a block of text, "Two young boys played soccer." would be analyzed and show the result (hopefully though my grammar is a bit rusty):
noun=2
verb=1
adjective=2

I would appreciate any suggestions regarding level of difficulty for a RunRev beginner, and if this project can be done by a beginner, any help getting started: leads, sample stacks/tutorials to check out, suggestions how to set up a small test version on which to build.

I think this can be a good way to learn, if not too difficult.

Thanks for your help.

Kind Regards,
saratogacoach
LiveCode 4.6.0, Windows 7 Home Premium 64 bit, Core i7 2.80, 8G RAM, ATI Radeon HD5770

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Wed Jun 10, 2009 10:48 pm

sounds like a good starting stack, as long as your list of terms is extremely complete. especialy as many words have several ways to be spelled or change depending on context.

However, i suggest using the various chunk stuff to do what you want. try to understand the following entries in the dictionary (also, look up chunks in the documentation pdf):

itemdelimiter
linedelimiter
word
item
line
repeat for each item/line/word
offset
lineoffset
wordoffset
itemoffset
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

saratogacoach
Posts: 87
Joined: Thu Jul 17, 2008 8:42 pm

Post by saratogacoach » Wed Jun 10, 2009 11:01 pm

Thanks, Bvg.

After doing some of the reading, as you suggest, I would like to create a small test stack. I can create a small text file with 3 categories and 20 common words as a starting point.

Then a small stack with one text entry field (to drag text into) and a single button coded to open and read the text file and check if any words dropped into the entry field will match words in the text file, then finally a message box with results showing any matches.

Doesn't sound too difficult, but I suspect easier said than done.

Tried a little experiment on chunks: created a stack with an entry field ("Field1") and a button. Previewed and typed into the field "My name is saratogacoach." Button code:

Code: Select all

on mouseUp
   put word 4 of field "Field1" into temptext
   answer temptext
end mouseUp
OK, that works. :)

Kind Regards,
saratogacoach
LiveCode 4.6.0, Windows 7 Home Premium 64 bit, Core i7 2.80, 8G RAM, ATI Radeon HD5770

Post Reply