Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Oct 2009
    Posts
    8

    Unanswered: help with cursor , how many to use

    i have two rules(in fact many more, but i can put them in a cursor and execute one at a time) as below:

    ID ConvertFrom ConvertTo Cond1_Type Cond1 Cond2_Type Cond2 Cond1_Position Cond2_Position
    1 IN WDT wd that tag NNS 0 -1
    2 IN WDT wd that tag VBZ 0 1

    cond 1 or 2 position means the row number from the current row number


    now i have a table

    ItemID WordTokenPosition Word Tag
    1 1 You PRP
    1 2 received VBD
    1 3 a DT
    1 4 new JJ
    1 5 voicemail NULL
    2 1 The DT
    2 2 info NULL
    2 3 box NN
    2 4 for IN
    2 5 adding VBG
    2 6 other JJ
    2 7 accounts NNS

    item id 1 or 2 denotes the sentence number in which the words have been parsed and then tagged. I want to go through the first mentioned 2 rules and re tag each word according to the conditions mentioned.

    Please help. Thanks a load in advance

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Huh?

    Care to post some DDL, sample data in DML form, and what the expected result is suppose to be
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Oct 2009
    Posts
    8
    i have the two tables... and ill have to iterate each rule from the rule table to go over each row in the second table... and the final result will be the correct tag as defined by the rule

    hope this helps!

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    What are these rules you are describing and what are they written in/as
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Oct 2009
    Posts
    8
    they are in one table.. so i was writing one cursor to pick up a rule at a time and then work each rule on the other table!

    thanks!

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Is this a rule?

    Code:
    ID ConvertFrom ConvertTo Cond1_Type Cond1 Cond2_Type Cond2 Cond1_Position Cond2_Position
    1 IN WDT wd that tag NNS 0 -1
    2 IN WDT wd that tag VBZ 0 1
    How are they implemented?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  7. #7
    Join Date
    Oct 2009
    Posts
    8
    these are two rules.

    rule 1 (1 IN WDT wd that tag NNS 0 -1) is read as : if word is 'that' as position 0 ie same row and tag is NNS at position -1 ie previous row then convert tag from WDT to tag IN . the word and tag columns are present in the second table...

    let me know if that makes sense.

    Thanks!

  8. #8
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    No

    But I understand

    Previous row in a database is basically meanigless...check that...dangerous

    I was actually asking you how you deconstruct your "rule" and enforce it with T-SQl code

    Or are you going to call CRL?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  9. #9
    Join Date
    Oct 2009
    Posts
    8
    no, the tagger i need to implement needs to refer the previous row... what i did was did a self join to have the previous row values in the current row...

    now I dunno how to deconstruct and implement the rule... that was the main reason for posting in this forum.. hee hee...

    and what is CRL please??

    thanks!

  10. #10
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    who created the "Rules"
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  11. #11
    Join Date
    Oct 2009
    Posts
    8
    somebody called Erin Brill, during his Phd thesis!

  12. #12
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Thesis on what?

    Where are you located?

    Erin Brill | Facebook
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  13. #13
    Join Date
    Oct 2009
    Posts
    8
    its some text mining thing.....

    Brill tagger - Wikipedia, the free encyclopedia

    facebook was not existant in 1993

  14. #14
    Join Date
    Oct 2002
    Location
    Baghdad, Iraq
    Posts
    697
    Trying to do something like this in SQL is one of those things that's theoretically possible, but insane. Cursors are there for the occasional iteration, and if you're asking about multiple cursors or complex stuff with cursors, it's a sure sign you should not be using SQL.

    AI stuff like this is often implemented in LISP; this is no exception.

    *If* you can learn LISP, that's your best shot. You can write stored procedures in any .NET language for SQL Server, and L# is a .NET version of LISP. Even if all you can handle is VB.net, that would be preferable to straight SQL.

  15. #15
    Join Date
    Oct 2009
    Posts
    8
    I do know LISP.. and I have done worse stuff in SQL... and am almost close to figuring this out too... and its not THAT CRAZY, as much as YOU think!

    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
  •