Get keywords from text/ Find all different words within text

This script was created to solve some problems we had when trying to maintain a mailing list.

  • We had two mailing lists and we wanted to put them together.
  • As both mailing lists were related, several emails were in both lists.
  • Emails from both emails were obtained
  • The script was run with all emails
  • We get a unique list without repited emails
Latter we have also used this script to
  • obtained all different words in a text file for indexing porpouse.
  • manage keywords for inclusion in our meta tags


Basics of the script:

  • This is a copy and paste script (the file must be named "Getkeywordsfromtext.asp").
  • The form is included in the script.
  • The script allows
    • to define the separator between words
    • to remove some predefined special characters
    • to remove custom specified words or characters
  • The response is not formated (you will obtain a text with the result.)

 
Getkeywordsfromtext.asp  Try it
<% 
if request.form="" then
Sendform()
else
SendResponse()
end if 
%>

<% sub SendResponse()
Thetext=request.form("Thetext")

if request.form("c1")="1" then
Thetext=Replace(Thetext,"."," ")
end if 
if request.form("c2")="1" then
Thetext=Replace(Thetext,","," ")
end if 
if request.form("c3")="1" then
Thetext=Replace(Thetext,";"," ")
end if 
if request.form("c4")="1" then
Thetext=Replace(Thetext,":"," ")
end if 
if request.form("c5")="1" then
Thetext=Replace(Thetext,"<"," ")
end if 
if request.form("c6")="1" then
Thetext=Replace(Thetext,">"," ")
end if 
if request.form("c7")="1" then
Thetext=Replace(Thetext,CHR(34)," ")
end if 
if request.form("c8")="1" then
Thetext=Replace(Thetext,CHR(39)," ")
end if 
if request.form("c9")="1" then
Thetext=Replace(Thetext,"!"," ")
end if 
if request.form("c10")<>"" then
CharactersArray=Array(request.form("c10"))
MaxCharactersArray=ubound(CharactersArray)
for j=0 to MaxCharactersArray
Thetext=Replace(Thetext,CharactersArray(j)," ")
next
end if
 
 

if request.form("separator")="space" then
Separator=" "
else
Separator=request.form("separator2")
end if

Casesitive=request.form("casesensitive")
Theseparatedworlds=split (Thetext,Separator)
max=ubound(Theseparatedworlds)
Thetext=Separator

for counter=0 to max
  if instr (1,Thetext,Separator &Theseparatedworlds(counter) & Separator,Casesitive)=0 then
   Thetext=Thetext & Theseparatedworlds(counter)  & Separator
 end if
next
Response.write(Thetext)
end sub
%>

<% sub Sendform() %>
<HTML><BODY BGCOLOR=FFFFFF>
<center>
<FORM method=post action=Getkeywordsfromtext.asp>
<table border=0><tr><td>
<TEXTAREA name=theText rows=10 Cols=60></TEXTAREA><br>
<input type=checkbox name=separator value=space checked> Space
<input type=text name=separator2 size=3> Other separator<br>
<input type=radio name=casesensitive value=0> Key sensitive
<input type=radio name=casesensitive value=1 checked> No key sensitive<p>

</td><td valign=top>

<b>Remove especial characters:</b><br>
<input type=radio name=c2 value=1 checked> .<br>
<input type=radio name=c3 value=1 checked> ,<br>
<input type=radio name=c4 value=1 checked> ;<br>
<input type=radio name=c5 value=1 checked> :<br>
<input type=radio name=c6 value=1 checked> <<br>
<input type=radio name=c7 value=1 checked> ><br>
<input type=radio name=c1 value=1 checked> "<br>
<input type=radio name=c8 value=1 checked> '<br>
<input type=radio name=c9 value=1 checked> !<br>
<fonr size=2>Characters of words separated by commas</font>
<input type=text name=c10 size=5><br>

</td></tr></table>

<INPUT type=submit value="Get keywords / Find all different words">
</FORM>
</center>

<div align=right>
Script provided by <a href=http://www.codedcode.com>codedcode.com</a>
</div>

</body></html>
<% end sub %>


 
Examples:

Text:
My friend has a big dog in the yard and he is very agresive. There are two reasons for this behavior: he is alone all the day long and he has never been treated with love. The postman has no problems with the dog. In fact the dog is very happy whenever the postman arrives. the postman is sometimes the only visit during the day. 

Conditions: Separator, space. All especial characters checked. No case sensitive

Output:
My friend has a big dog in the yard and he is very agresive There are two reasons for this behavior alone all day long never been treated with love postman no problems fact happy whenever arrives sometimes only visit during




Google






   



MSN Nick Name



More Resources...





Most Viewed Services:
  1. HTML Tutorial
  2. XHTML Tutorial
  3. CSS Tutorial
  4. Javascript Tutorial
  5. DHTML Tutorial
  6. VB Script
  7. TCP/IP Tutorial
  8. ADO Tutorial
  9. MYSQL Tutorial
  10. ASP Tutorial
  11. AJAX Tutorial
  12. CFML Tutorial
  13. PHP Tutorial
  14. WML Tutorial
  15. FLASH Tutorial
  16. XML Tutorial
  17. RSS Tutorial
  18. SQL Tutorial
  19. HTML Articles
  1. Javascript Articles
  2. PHP Articles
  3. SEO Articles
  4. Web Design Articles
  5. SEO Tips
  6. Web Design Tips
  7. Articles
  8. CSS
  9. CSS Tips
  10. HTML Tips
  11. JAVASCRIPT Tips
  12. MYSQL Tips
  13. PHP Tips
  14. Money
  15. Tutorials
  16. Web Hosting



  • Home
  • Web Directory
  • Top Directoriers
  • Webmaster Directories
  • Contact
  • © Copyright 2006-2010 All Rights Reserved By CodeDcode.Com : HTML : RSS : TEXT : XML