SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Nov 2004
    Posts
    47
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How to compare two sentences(Para\'s)

    I need to compare expected and actual values which is nothing but two paragraphs.
    Is there a best way experts suggest to do this?

    I have been using the strcomp built in function but the problem I am seeing is it always results in "-1" as the two paras differ by spaces per my understanding.
    I did a diff between these two I do not see any difference in text but again I cannot make out if there is any extra space in one para between any of the two words.

    I am thinking there might be a better way to debug this as I am tired looking at the text differences which I couldn't find and now I hae to look at Space difference between each words... This looks to be quite impossible for me as there are like 100 words in one para.

    I haven't used wdiff.exe , not sure how this works.Any ideas?

    Any help/ideas appreciated.

  2. #2
    New Member
    Join Date
    Feb 2009
    Location
    CA San Francisco
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to compare two sentences(Para\'s)

    What I would do is "clean" both paragraphs-"strings" from spaces and after that check each letter with your paragraph until they are not equal or equal which means it pass verification.

    somthing like that:
    1)clean from spaces
    2)if len(somenameOfString1)<>len(somenameOfString 2)then
    "failed" and exit
    3)for i=0 to len(somenameOfString1)
    if somenameOfString1(i)<>somenameOfString2(i) then
    "failed" exit
    next
    "passed"
    ============================

    Hope this helped

    :-)

  3. #3
    Senior Member
    Join Date
    Jul 2007
    Location
    Amman, Jordan
    Posts
    281
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to compare two sentences(Para\'s)

    I used to face this a a lot when comparing words and some turn out of to have double spaces (apparently the run results filters those double spaces so you won't be able to see them.) you are going to have to debug each paragraph and see where the double space is. trust strcomp [img]/images/graemlins/smile.gif[/img]
    _______________________________________________
    1. LR Version: LR 9.5
    2. protocol: Web (HTTP/HTML)
    3. HTML-Advanced with URLs: No
    4. URL mode: N/A
    5. LR FP: N/A
    6. VuGen Recording: New Engine
    7. Web & Multimedia 1700 - Oracle E-Business 100
    8. support/maintenance contract active: yes
    9. Windows 2003 R2
    10. Did not file

  4. #4
    Senior Member
    Join Date
    Apr 2007
    Posts
    124
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to compare two sentences(Para\'s)

    I usually ingnore spaces when comparing paragraphs. Also do not forget to get rid of returns and etc, such as CHR(13),CHR(8).

    Use replace function to perform that task -
    tmVal = replace(tmVal," ","") - will replace all spaces with empty (will clear all spaces)
    QA automation

  5. #5
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: How to compare two sentences(Para\'s)

    You can try the Text Comparison API.

    http://knowledgeinbox.com/forums/fee...ison-api-beta/

  6. #6
    Member
    Join Date
    Nov 2004
    Posts
    47
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to compare two sentences(Para\'s)

    Tarun,

    Thanks much for your input. I tried executing the script(Copied code) in qtp but I get error message
    "ActiveX component can't create object: 'KnowledgeInbox.AdvancedTextCompare'"

    Is there anything I am missing?

  7. #7
    Advanced Member
    Join Date
    Sep 2007
    Location
    Chennai, Tamil nadu, India
    Posts
    999
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to compare two sentences(Para\'s)

    Did you register the DLL? if not do it with admin rights by using below code

    RegSvr32 "<path>\<DLLName>"

    and atleast .net framework 2.0 to be installed in your system.
    i have never seen bugs sleeping

  8. #8
    Member
    Join Date
    Aug 2005
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to compare two sentences(Para\'s)

    Tarun,

    I searched the knowledge inbox forum but I couldn't find the DLL. Can you please let me know where I can download this?

  9. #9
    Advanced Member
    Join Date
    Sep 2007
    Location
    Chennai, Tamil nadu, India
    Posts
    999
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to compare two sentences(Para\'s)

    i have never seen bugs sleeping

  10. #10
    Member
    Join Date
    Aug 2005
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to compare two sentences(Para\'s)

    I was not able to find the DLL because I did not log in to the Knowledge Inbox forum.

    When I logged in I was able to see the download link for the DLL.
    Thanks.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 8.82%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:48 PM.

Copyright BetaSoft Inc.