SELECT client_id,keyword FROM keywords WHERE client_id = '#COOKIE.USER#' SELECT keyword FROM get_keywords WHERE (keyword = '#the_word#') OR (keyword = '#the_word_pd#') OR (keyword = '#the_word_cm#') OR (keyword = '#the_word_ap#') OR (keyword = '#the_word_appd#') AND client_id = '#COOKIE.USER#' #the_word_appd#'s. #the_word_ap#'s #the_word_pd#. #the_word_cm#, #the_word# Any help would be appreciated. Thanks in advance! - yvan [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <1108909832.339667.240540@f14g2000cwb.googlegroups.com> [ref] => [htmlstate] => on_nl2br [postusername] => yvan@ideasdesign.com [ip] => yvan@ideasdesig [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> SELECT client_id,keyword FROM keywords WHERE client_id = '#COOKIE.USER#' SELECT keyword FROM get_keywords WHERE (keyword = '#the_word#') OR (keyword = '#the_word_pd#') OR (keyword = '#the_word_cm#') OR (keyword = '#the_word_ap#') OR (keyword = '#the_word_appd#') AND client_id = '#COOKIE.USER#' #the_word_appd#'s. #the_word_ap#'s #the_word_pd#. #the_word_cm#, #the_word# Any help would be appreciated. Thanks in advance! - yvan [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <1108909873.498052.59430@c13g2000cwb.googlegroups.com> [ref] => [htmlstate] => on_nl2br [postusername] => yvan@ideasdesign.com [ip] => yvan@ideasdesig [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => 1 [isfirstshown] => [attachments] => [allattachments] => ) --> Break paragraph into list of words / keyword detection - Macromedia ColdFusion

Break paragraph into list of words / keyword detection - Macromedia ColdFusion

I'm writing an journaling type of application, and I was wondering if someone might be able to help me re-write one of the modules so it's more streamlined and compact, and so that it requires less maintenance. Here's the situation: A person fills out and submits a journal entry. I then call a routine that extracts each individual word in the journal entry and converts them into an array of checkboxes, each having one of the extracted words beside it. The user can then check one or more of the boxes to indicate which of the words they'd like to ...

  1. #1

    Default Break paragraph into list of words / keyword detection

    I'm writing an journaling type of application, and I was wondering if
    someone might be able to help me re-write one of the modules so it's
    more streamlined and compact, and so that it requires less maintenance.
    Here's the situation:

    A person fills out and submits a journal entry. I then call a routine
    that extracts each individual word in the journal entry and converts
    them into an array of checkboxes, each having one of the extracted
    words beside it. The user can then check one or more of the boxes to
    indicate which of the words they'd like to have written to the database
    as a "keyword". The purpose for this is so that when the journal entry
    is retrieved from the database and viewed at a later time, any keywords
    found will be hyperlinked, and can be clicked on to display search
    results for other journal entries that contain that keyword.

    It seems to be working quite well, only I've come up against a problem
    where keywords which contain punctuation in them have to be handled
    differently, which requires lots of additional programming. Also, the
    programming I currently have in place is case sensitive, which means
    that the word "joe" and "Joe" are treated as being completley different
    strings, which I would prefer to have NOT be the case.

    What I'd like to know is if there might be a better and more efficient
    way for me to go about this. Specifically, I'd like to be able to avoid
    having to program additional routines to handle punctuation within
    keywords, and for the keyword detection to NOT be case sensitive.

    Here's the code that I have so far:

    <!--- QUERY KEYWORDS TABLE //--->

    <cfquery datasource="MyDSN" name="get_keywords">
    SELECT client_id,keyword
    FROM keywords
    WHERE client_id = '#COOKIE.USER#'
    </cfquery>

    <!--- QUERY KEYWORDS TABLE //--->

    <CFSET word_list = "#JournalEntry#">

    <CFLOOP INDEX="the_word" LIST="#word_list#" DELIMITERS=" ">

    <CFSET theword = "#the_word#">

    <!--- ASSIGN WORDS THAT CONTAIN PUNCTUATION TO NEW VARIABLES //--->

    <cfif the_word CONTAINS "'s.">

    <cfset the_word_appd = REPLACE(#the_word#,"'s.",'',"ALL")>
    <cfset thewordappd = REPLACE(#the_word#,"'s.",'',"ALL")>

    <cfset the_word_pd = the_word>
    <cfset thewordpd = the_word>

    <cfset the_word_cm = the_word>
    <cfset thewordcm = the_word>

    <cfset the_word_ap = the_word>
    <cfset thewordap = the_word>

    <cfelseif the_word CONTAINS "'s">

    <cfset the_word_ap = REPLACE(#the_word#,"'s",'',"ALL")>
    <cfset thewordap = REPLACE(#the_word#,"'s",'',"ALL")>

    <cfset the_word_pd = the_word>
    <cfset thewordpd = the_word>

    <cfset the_word_cm = the_word>
    <cfset thewordcm = the_word>

    <cfset the_word_appd = the_word>
    <cfset thewordappd = the_word>

    <cfelseif the_word CONTAINS ".">

    <cfset the_word_pd = REPLACE(#the_word#,".",'',"ALL")>
    <cfset thewordpd = REPLACE(#the_word#,".",'',"ALL")>

    <cfset the_word_ap = the_word>
    <cfset thewordap = the_word>

    <cfset the_word_cm = the_word>
    <cfset thewordcm = the_word>

    <cfset the_word_appd = the_word>
    <cfset thewordappd = the_word>

    <cfelseif the_word CONTAINS ",">

    <cfset the_word_cm = REPLACE(#the_word#,",",'',"ALL")>
    <cfset thewordcm = REPLACE(#the_word#,",",'',"ALL")>

    <cfset the_word_ap = the_word>
    <cfset thewordap = the_word>

    <cfset the_word_pd = the_word>
    <cfset thewordpd = the_word>

    <cfset the_word_appd = the_word>
    <cfset thewordappd = the_word>

    <cfelse>

    <cfset the_word_pd = the_word>
    <cfset thewordpd = the_word>

    <cfset the_word_cm = the_word>
    <cfset thewordcm = the_word>

    <cfset the_word_ap = the_word>
    <cfset thewordap = the_word>

    <cfset the_word_appd = the_word>
    <cfset thewordappd = the_word>

    </cfif>

    <!--- ASSIGN WORDS THAT CONTAIN PUNCTUATION TO NEW VARIABLES //--->


    <!--- CHECK TO SEE IF THE KEYWORD IS IN THE DATABASE //--->

    <cfquery dbtype="query" name="check_keyword">
    SELECT keyword
    FROM get_keywords
    WHERE (keyword = '#the_word#') OR (keyword = '#the_word_pd#') OR
    (keyword = '#the_word_cm#') OR (keyword = '#the_word_ap#') OR (keyword
    = '#the_word_appd#')
    AND client_id = '#COOKIE.USER#'
    </cfquery>

    <!--- CHECK TO SEE IF THE KEYWORD IS IN THE DATABASE //--->


    <!--- HIGHTLIGHT AND HYPERLINK WORD IF IT'S A KEYWORD //--->

    <cfset the_word = "<a
    href=entry.cfm?search_process=true&keyword=#thewor d#
    class=#the_class#>#the_word#</a>">

    <cfset the_word_pd = "<a
    href=entry.cfm?search_process=true&keyword=#thewor dpd#
    class=#the_class#>#the_word_pd#</a>">

    <cfset the_word_cm = "<a
    href=entry.cfm?search_process=true&keyword=#thewor dcm#
    class=#the_class#>#the_word_cm#</a>">

    <cfset the_word_ap = "<a
    href=entry.cfm?search_process=true&keyword=#thewor dap#
    class=#the_class#>#the_word_ap#</a>">

    <cfset the_word_appd = "<a
    href=entry.cfm?search_process=true&keyword=#thewor dappd#
    class=#the_class#>#the_word_appd#</a>">

    <!--- HIGHTLIGHT AND HYPERLINK WORD IF IT'S A KEYWORD //--->

    <!--- DISPLAY THE NEXT WORD IN THE LOOP //--->

    <cfoutput>

    <font face="garamond" color="333333" size="3">

    <cfif theword CONTAINS "'s.">

    #the_word_appd#'s.

    <cfelseif theword CONTAINS "'s">

    #the_word_ap#'s

    <cfelseif theword CONTAINS ".">

    #the_word_pd#.

    <cfelseif theword CONTAINS ",">

    #the_word_cm#,

    <cfelse>

    #the_word#

    </cfif>

    </font>

    </cfoutput>

    </font>

    <!--- DISPLAY THE NEXT WORD IN THE LOOP //--->

    </cfloop>



    Any help would be appreciated. Thanks in advance!

    - yvan

    yvan@ideasdesign.com Guest

  2. #2

    Default Break paragraph into list of words / keyword detection

    I'm writing an journaling type of application, and I was wondering if
    someone might be able to help me re-write one of the modules so it's
    more streamlined and compact, and so that it requires less maintenance.
    Here's the situation:

    A person fills out and submits a journal entry. I then call a routine
    that extracts each individual word in the journal entry and converts
    them into an array of checkboxes, each having one of the extracted
    words beside it. The user can then check one or more of the boxes to
    indicate which of the words they'd like to have written to the database
    as a "keyword". The purpose for this is so that when the journal entry
    is retrieved from the database and viewed at a later time, any keywords
    found will be hyperlinked, and can be clicked on to display search
    results for other journal entries that contain that keyword.

    It seems to be working quite well, only I've come up against a problem
    where keywords which contain punctuation in them have to be handled
    differently, which requires lots of additional programming. Also, the
    programming I currently have in place is case sensitive, which means
    that the word "joe" and "Joe" are treated as being completley different
    strings, which I would prefer to have NOT be the case.

    What I'd like to know is if there might be a better and more efficient
    way for me to go about this. Specifically, I'd like to be able to avoid
    having to program additional routines to handle punctuation within
    keywords, and for the keyword detection to NOT be case sensitive.

    Here's the code that I have so far:

    <!--- QUERY KEYWORDS TABLE //--->

    <cfquery datasource="MyDSN" name="get_keywords">
    SELECT client_id,keyword
    FROM keywords
    WHERE client_id = '#COOKIE.USER#'
    </cfquery>

    <!--- QUERY KEYWORDS TABLE //--->

    <CFSET word_list = "#JournalEntry#">

    <CFLOOP INDEX="the_word" LIST="#word_list#" DELIMITERS=" ">

    <CFSET theword = "#the_word#">

    <!--- ASSIGN WORDS THAT CONTAIN PUNCTUATION TO NEW VARIABLES //--->

    <cfif the_word CONTAINS "'s.">

    <cfset the_word_appd = REPLACE(#the_word#,"'s.",'',"ALL")>
    <cfset thewordappd = REPLACE(#the_word#,"'s.",'',"ALL")>

    <cfset the_word_pd = the_word>
    <cfset thewordpd = the_word>

    <cfset the_word_cm = the_word>
    <cfset thewordcm = the_word>

    <cfset the_word_ap = the_word>
    <cfset thewordap = the_word>

    <cfelseif the_word CONTAINS "'s">

    <cfset the_word_ap = REPLACE(#the_word#,"'s",'',"ALL")>
    <cfset thewordap = REPLACE(#the_word#,"'s",'',"ALL")>

    <cfset the_word_pd = the_word>
    <cfset thewordpd = the_word>

    <cfset the_word_cm = the_word>
    <cfset thewordcm = the_word>

    <cfset the_word_appd = the_word>
    <cfset thewordappd = the_word>

    <cfelseif the_word CONTAINS ".">

    <cfset the_word_pd = REPLACE(#the_word#,".",'',"ALL")>
    <cfset thewordpd = REPLACE(#the_word#,".",'',"ALL")>

    <cfset the_word_ap = the_word>
    <cfset thewordap = the_word>

    <cfset the_word_cm = the_word>
    <cfset thewordcm = the_word>

    <cfset the_word_appd = the_word>
    <cfset thewordappd = the_word>

    <cfelseif the_word CONTAINS ",">

    <cfset the_word_cm = REPLACE(#the_word#,",",'',"ALL")>
    <cfset thewordcm = REPLACE(#the_word#,",",'',"ALL")>

    <cfset the_word_ap = the_word>
    <cfset thewordap = the_word>

    <cfset the_word_pd = the_word>
    <cfset thewordpd = the_word>

    <cfset the_word_appd = the_word>
    <cfset thewordappd = the_word>

    <cfelse>

    <cfset the_word_pd = the_word>
    <cfset thewordpd = the_word>

    <cfset the_word_cm = the_word>
    <cfset thewordcm = the_word>

    <cfset the_word_ap = the_word>
    <cfset thewordap = the_word>

    <cfset the_word_appd = the_word>
    <cfset thewordappd = the_word>

    </cfif>

    <!--- ASSIGN WORDS THAT CONTAIN PUNCTUATION TO NEW VARIABLES //--->


    <!--- CHECK TO SEE IF THE KEYWORD IS IN THE DATABASE //--->

    <cfquery dbtype="query" name="check_keyword">
    SELECT keyword
    FROM get_keywords
    WHERE (keyword = '#the_word#') OR (keyword = '#the_word_pd#') OR
    (keyword = '#the_word_cm#') OR (keyword = '#the_word_ap#') OR (keyword
    = '#the_word_appd#')
    AND client_id = '#COOKIE.USER#'
    </cfquery>

    <!--- CHECK TO SEE IF THE KEYWORD IS IN THE DATABASE //--->


    <!--- HIGHTLIGHT AND HYPERLINK WORD IF IT'S A KEYWORD //--->

    <cfset the_word = "<a
    href=entry.cfm?search_process=true&keyword=#thewor d#
    class=#the_class#>#the_word#</a>">

    <cfset the_word_pd = "<a
    href=entry.cfm?search_process=true&keyword=#thewor dpd#
    class=#the_class#>#the_word_pd#</a>">

    <cfset the_word_cm = "<a
    href=entry.cfm?search_process=true&keyword=#thewor dcm#
    class=#the_class#>#the_word_cm#</a>">

    <cfset the_word_ap = "<a
    href=entry.cfm?search_process=true&keyword=#thewor dap#
    class=#the_class#>#the_word_ap#</a>">

    <cfset the_word_appd = "<a
    href=entry.cfm?search_process=true&keyword=#thewor dappd#
    class=#the_class#>#the_word_appd#</a>">

    <!--- HIGHTLIGHT AND HYPERLINK WORD IF IT'S A KEYWORD //--->

    <!--- DISPLAY THE NEXT WORD IN THE LOOP //--->

    <cfoutput>

    <font face="garamond" color="333333" size="3">

    <cfif theword CONTAINS "'s.">

    #the_word_appd#'s.

    <cfelseif theword CONTAINS "'s">

    #the_word_ap#'s

    <cfelseif theword CONTAINS ".">

    #the_word_pd#.

    <cfelseif theword CONTAINS ",">

    #the_word_cm#,

    <cfelse>

    #the_word#

    </cfif>

    </font>

    </cfoutput>

    </font>

    <!--- DISPLAY THE NEXT WORD IN THE LOOP //--->

    </cfloop>



    Any help would be appreciated. Thanks in advance!

    - yvan

    yvan@ideasdesign.com Guest

Similar Threads

  1. PDWordFinder - Setting characters used to break up words
    By Eliott_Hayut@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 21
    Last Post: October 16th, 03:06 AM
  2. Printing or Exporting Paragraph style list
    By Meredith_Lamb@adobeforums.com in forum Adobe Indesign Macintosh
    Replies: 4
    Last Post: August 24th, 05:04 PM
  3. List words in fulltext index
    By Ruben van Engelenburg in forum MySQL
    Replies: 0
    Last Post: July 27th, 01:06 PM
  4. break paragraph of text into individual words / keyword detection
    By yvan@ideasdesign.com in forum Coldfusion - Getting Started
    Replies: 0
    Last Post: February 20th, 02:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •