SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Synonym-Given String


Synonym-Given String

Author
Message
kavi-1053213
kavi-1053213
SSC Veteran
SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)

Group: General Forum Members
Points: 201 Visits: 46
Hi All,


i need to find list of synonyms for a given string using sql server,is there a query to retrive list of synonyms for a given word ?
arun.sas
arun.sas
SSCarpal Tunnel
SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)

Group: General Forum Members
Points: 4551 Visits: 3493
HI,

Possible, when you create the table and store all the synonyms for the words

ARUN SAS
kavi-1053213
kavi-1053213
SSC Veteran
SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)

Group: General Forum Members
Points: 201 Visits: 46
Hi Arun ,

Thanks for ur reply, i need to find for (1000s of words) its not possible to find synonym for word by word and store it in a table ???? is it possible dynamically?

for example Sadlike built in Function) if we give the word it should generate its list of synonym... guide the query for this???
The Dixie Flatline
The Dixie Flatline
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19772 Visits: 6908
Kavi, could you give us an example of what you are trying to do? Some sample inputs and expected output would be most helpful.

__________________________________________________

Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
kavi-1053213
kavi-1053213
SSC Veteran
SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)

Group: General Forum Members
Points: 201 Visits: 46
Hi,

i have tried synonyms search with full text serach Thesaurus file, but it is needed to predefine the thesaurus file for each word, it is not feasible for me.So, i am looking for alternative option to find the synonyms search for the word.

For example: i need to find synonyms for any word for eg: the word "check" using sql query then the output should display all synonyms like the list below,

Try out
test
confirm
ensure
verify
prove
try


kindly help me with the query to execute this result...
The Dixie Flatline
The Dixie Flatline
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19772 Visits: 6908
Kavi, such a query is simple, but you will still have to define the synonyms. You may be able to search the internet and find some sort of thesaurus file that you could download to populate a synonyms table in your database.

How do you plan to use this?


declare @synonyms table
(rowID int identity (1,1), searchword varchar(20), synonymWord varchar(20)
primary key (searchword,rowid)
)
insert into @synonyms
select 'check','try out' union all
select 'check','test' union all
select 'check','confirm' union all
select 'check','ensure' union all
select 'check','verify' union all
select 'check','try' union all
select 'check','prove'

---------------------------------
select synonymWord
from @synonyms
where searchword = 'check'



__________________________________________________

Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
kavi-1053213
kavi-1053213
SSC Veteran
SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)SSC Veteran (201 reputation)

Group: General Forum Members
Points: 201 Visits: 46
Thanks Bob,

Still i am trying to search for an pre-filled thesaurus file that defined synonym for all english words...so far not found,

so wat i tried with some alternate solution,but the query wic u gave doesnt suits me because for word by word i need to insert synonyms its very tedious to insert for whole dictionary ,is there any other way????
Bruce W Cassidy
Bruce W Cassidy
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: General Forum Members
Points: 4739 Visits: 1033
kavi (3/30/2009)
Hi All,
i need to find list of synonyms for a given string using sql server,is there a query to retrive list of synonyms for a given word ?

Kavi,

This is not a feature built into SQL Server. It's one you would have to create programmatically. I suggest you go grab a copy of an English Language Thesaurus from your library. If you really want to sit down and encode all of that, then feel free.

So no, there is no query to retrieve a list of synonyms for a given word. Not unless you build one.

The Dixie Flatline
The Dixie Flatline
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19772 Visits: 6908
Kavi, if you are looking to build your own thesaurus file, you can certainly parse a string of synonyms this way, to make the population easier. This technique could be modified to translate an entire table. If you have questions about this, there are some good articles and forum posts already written under the headings PARSE and TALLY TABLE.

I hate to leave you now, but it's midnight here and I have to get some sleep. I'll check back in about nine hours.

I hope this helps.


declare @synonyms table (rowID int identity (1,1), searchword varchar(20), synonymWord varchar(20)
primary key (searchword,rowid))

--------------------------------------------------------------
declare @synonym_list varchar(7900)
declare @sepChar varchar(50)
declare @element varchar(4)
declare @searchword varchar(20)
--------------------------------------------------------------
set @searchword = 'check'
set @synonym_list = 'try out, test, examine, confirm, verify'
set @sepchar = ','
set @synonym_list = @sepChar+@synonym_list+@sepChar
--------------------------------------------------------------
;WITH
L0 AS (SELECT 1 AS C UNION ALL SELECT 1), --2 rows
L1 AS (SELECT 1 AS C FROM L0 AS A, L0 AS B),--4 rows "L0 as A, L0 as B" is just shorthand way to code a cross join
L2 AS (SELECT 1 AS C FROM L1 AS A, L1 AS B),--16 rows
L3 AS (SELECT 1 AS C FROM L2 AS A, L2 AS B),--256 rows
L4 AS (SELECT 1 AS C FROM L3 AS A, L3 AS B),--65536 rows
Tally AS (SELECT TOP 1000 ROW_NUMBER() OVER(ORDER BY C) AS N FROM L4),
syns AS
(select Row_Number() over (order by N) as E,
ltrim(rtrim(substring(@synonym_list,N+1,charindex(@sepChar,@synonym_list,N+1)-(N+1)))) as synWord
from tally
where substring(@synonym_list,N,1) = @sepChar
and N < len(@synonym_list)
)
--
insert into @synonyms
select @searchword,synword from syns
----------------------------------------------
select *
from @synonyms
where searchword = 'check'






__________________________________________________

Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
Tim Wilson-Brown
Tim Wilson-Brown
SSChasing Mays
SSChasing Mays (603 reputation)SSChasing Mays (603 reputation)SSChasing Mays (603 reputation)SSChasing Mays (603 reputation)SSChasing Mays (603 reputation)SSChasing Mays (603 reputation)SSChasing Mays (603 reputation)SSChasing Mays (603 reputation)

Group: General Forum Members
Points: 603 Visits: 302
This is a multiple post. Some discussion has occured at http://www.sqlservercentral.com/Forums/Topic685529-145-1.aspx.

However, this discussion has developed further.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search