List Words
See
http://taporware.mcmaster.ca/~taporware/htmlTools/listword.shtml
Description
This tool can be used to list all of the words or user specified words found within a specified tag. For example, list all words matching a user entered pattern, list all words except user specified stop words. The query results can be displayed alphabetically, by frequency, by order of appearance, or in reversed alphabetical order. If no tag is specified, the <body> tag is used.
Term Defination
- stop words: Words ignored in a query because they are so commonly used that they can't contribute to relevancy. Includes conjunctions, prepositions, and articles such as and, to and a.
- pattern: A sequence of characters used either with regular expression notation or for path name expansion, as a means of selecting various character strings or path names, respectively. Values are matched against patterns to see if they should be included/excluded. In patterns "*" matches any string, "?" matches any single character.
Predefined Parameter Values in Tool Bar
- Source: the page the user is currently in.
- Element:
body or set by site owner
- Words listed: all words except the glasgow stop-list
- Stemmer: use inflectional stemmer to process all the words before listing
- Sorting: by frequency
- Display format: HTML
Pseudocode
- Obtain HTML string by URL or from user's local disk
- Tokenize text into words using spaces and punctuation marks
- Sort and count words with similar letters ignoring capitalization
- Extract words based on user specified criteria if necessary
- Generate output format based on user's selection
Ways of Using
- Enter a valid URL in the URL field or enter a local upload html text
- Enter a valid html tag or tag list seperated by comma, default is "body"
- Select which list you want to get and enter the corresponding text if necessary
- Select sorting criterion
- Select output format
- If you want the results displayed in the same window with taporware interface, uncheck the check box - "Open results in new window"
- Finally, click the "Submit" button
CGI Interface
If you want to use this tool from your web site, here is the CGI Interface:
(
Note: You need to use attribute name/value pair: enctype="multipart/form-data" within the form tag because the tool was to designed to allow local file uploading even if you do not use this feature)
Here are the parameters:
| Parameter Name | Parameter Value | Control Type | Default | Discription |
| source | url/local | radio button | url | Let user select input text (either a url or upload local html text) |
| htmlurl | | text | | A valid URL that the pointed document should be an html text |
| localFile | | file | | The path to your local html text file |
| tagword | | text | body | Valid html element (tag) name or multple html element name separated by comma |
| range | all/patt/find/stop | radio button | all | Options that let user select the word list he/she want to see |
| wpat | | text | | A unix styled pattern. This field corresponding to the value "patt" in the radio button group named "range" |
| findstop | typedin/textfile/glasgow | radio button | glasgow | The option are connected with value "find" and "stop" in the radio button group named "range" |
| typedinword | | text | | This text field is corresponding to the value "typedin" of radio button group named "findstop" |
| wordfile | | file | | This field is corresponding to the value "textfile" of radio button group named "findstop" |
| listsort | 1/2/3/4 | selection | 2 | Sorting criteria which are alphabetically/by frequency/by order of first appearance/by reversed alphabetic order in the order of parameter values |
| listdisp | 1/2/3/4 | selection | 2 | Display format which are XML tags in HTML/HTML/XML tree/tab Delimited Text in the order of parameter values |
| taporface | | checkbox | checked | display result in a new window without graphics interface (default) or with taporware interface in the same window |
Use List Words TAPoRware Tool in Your Web Page
You can add a button in your web page to list all the words in that page by call
TAPoRware cgi script.
Here is the code for this button interface:
<form method="post" name="htmlForm" enctype="multipart/form-data" target="_blank"
action="http://taporware.mcmaster.ca/~taporware/cgi-bin/prototype/hlistword.cgi"
onsubmit="document.htmlForm.htmlurl.value=document.location.href">
<input type="hidden" name="source" value="url" />
<input type="hidden" name="htmlurl" />
<input type="hidden" name="freetext" value="yes"/>
<input type="hidden" name="range" value="all" />
<input type="hidden" name="listsort" value="2" />
<input type="hidden" name="sparkline" value="10" />
<input type="hidden" name="listdisp" value="2" />
<input type="hidden" name="taporface" value="same" />
<input type="submit" name="doIt" value="List All Words in The Tag" />
</form>
Web Service Interface
Taporware provides web services to any non-benefit organizations. here is the taporware web services infomation:
- Endpoint URL: http://taporware.mcmaster.ca:9982
- Service URI: http://taporware.mcmaster.ca/~taporware/webservice
- Service Method: list_Words_HTML
- parameters:
- htmlInput -- any html string
- htmlTag -- any html element (tag) name or multple html element name separated by comma
- listOption -- values are same as parameter "range" in the CGI interface above
- optionSeletion -- values are corresponding to the "list option"
- sorting -- values are same as parameter "listsort" in the CGI interface above
- outFormat -- values are same as parameter "listdisp" in the CGI interface above
REST Service Interface
Taporware Rest service uses plain text HTTP protocol so that you can submit your request use either POST or GET method.
- Service URI: http://tapor1-dev.mcmaster.ca/~restserv/html/listwords.
- Parameters:
- htmlInput -- any HTML text
- htmlTag --- any valid HTML tag in your submitted HTML text
- listOption -- a HTML single valued selection control (select or radio control). The values are same as parameter "range" in the CGI interface above.
- optionSeletion -- values depend on the "list option"
- sorting -- a select control. The values are same as parameter "sorting" in the CGI interface above
- outFormat -- a select control for output format. The values are same as parameter "display" in the CGI interface above
- See sample interface in http://tapor1-dev.mcmaster.ca/~restserv/html/listwordtool
Known Bugs
To Do
- There should be a setting to preserve capitalization so that "Canadian" and "canadian" would be two different words.
- We need to check multilingual texts - how are accents being handled?
--
MattPatey - 13 Oct 2005