| Author |
Topic  |
|
Stoad strehngthend
Yak Posting Veteran
54 Posts |
Posted - 09/05/2008 : 12:26:38
|
Of crs, I saw it. I meant "abcdef" = "abcdefxyzxyz", no referring to human names. Secondly, my exact taste is: CompareText(txt1, txt2) => LCS(txt1, txt2) / MAX(Len(txt1), Len(txt2)) * 100%, where LCS is Longest Common Subsequence of txt1 and txt2: http://en.wikipedia.org/wiki/Longest_common_subsequence And of course it's slow (O(n*m)):
CREATE FUNCTION mf_LCSLength
(
@x varchar(8000),
@y varchar(8000)
)
returns int
AS
/*
Computing the length of the LCS: http://en.wikipedia.org/wiki/Longest_common_subsequence
The below function takes as input sequences X[1..m] and Y[1..n] computes the LCS
between X[1..i] and Y[1..j] for all 1 = i = m and 1 = j = n, and stores it in
C[i,j]. C[m,n] will contain the length of the LCS of X and Y.
function LCSLength(X[1..m], Y[1..n])
C = array(0..m, 0..n)
for i := 0..m
C[i,0] = 0
for j := 0..n
C[0,j] = 0
for i := 1..m
for j := 1..n
if X[i] = Y[j]
C[i,j] := C[i-1,j-1] + 1
else:
C[i,j] := max(C[i,j-1], C[i-1,j])
return C[m,n]
*/
BEGIN
declare @i int
declare @j int
declare @p int
declare @q int
declare @n int
declare @m int
declare @t table (m int, a int, b int)
select @n = len(@x), @m = len(@y), @i = 0
while @i <= @m
begin
insert into @t select @i, 0, 0
set @i = @i + 1
end
set @i = 1
while @i <= @n
begin
set @j = 1
while @j <= @m
begin
if substring(@x, @i, 1) = substring(@y, @j, 1)
update @t set b = (select a from @t where m = @j - 1) + 1 where m = @j
else
begin
select @p = a from @t where m = @j
select @q = b from @t where m = @j - 1
if @p < @q set @p = @q
update @t set b = @p where m = @j
end
set @j = @j + 1
end
update @t set a = b
set @i = @i + 1
end
RETURN(select max(b) from @t)
END
set nocount on
declare @x varchar(8000)
declare @y varchar(8000)
select
@x = 'yupgayyeuntubajfncjxeyupxbpxfnxbntuxlyaludskiufntukonoyapanonaxlfojup',
@y = 'hfoqujhexjalicjxeyupfxpunapufangayyeualnujufnalibjxpntunapuhxsnjhannxntunapuhxsfxyqua'
select
@x=lower(@x), --@x=replace(@x,'a',''),@x=replace(@x,'e',''),@x=replace(@x,'i',''),@x=replace(@x,'o',''),@x=replace(@x,'u',''),
@y=lower(@y)--, @y=replace(@y,'a',''),@y=replace(@y,'e',''),@y=replace(@y,'i',''),@y=replace(@y,'o',''),@y=replace(@y,'u','')
select 'blindman:', dbo.CompareText(@x,@y)
select 'stoad:', 100.0*dbo.mf_LCSLength(@x,@y)/case when len(@x)>len(@y) then len(@x) else len(@y) end
--------- -----------
blindman: 45
------------- ----------------------------
stoad: 38.823529411764
-------------------------------------------------------------------------
WITHOUT VOWELES:
--------- ---------------------------------------------------------------
blindman: 39
------------- ----------------------------
stoad: 40.350877192982
Why two different blindman's results?
|
 |
|
|
blindman
Flowing Fount of Yak Knowledge
USA
2365 Posts |
Posted - 09/05/2008 : 13:33:13
|
Because two different Stoad inputs.
Boycotted Beijing Olympics 2008 |
 |
|
|
Stoad strehngthend
Yak Posting Veteran
54 Posts |
Posted - 09/05/2008 : 17:45:22
|
Yes I thought this:
--Convert to uppercase and remove noise characters set @TempString = UPPER(@InputString) set @TempString = replace(@TempString, 'A', '') set @TempString = replace(@TempString, 'E', '') set @TempString = replace(@TempString, 'I', '') set @TempString = replace(@TempString, 'O', '') set @TempString = replace(@TempString, 'U', '')
in dbo.CompareText()
|
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
USA
6997 Posts |
|
|
blindman
Flowing Fount of Yak Knowledge
USA
2365 Posts |
Posted - 09/07/2008 : 12:16:57
|
quote: Originally posted by Stoad strehngthend
Yes I thought this:
--Convert to uppercase and remove noise characters set @TempString = UPPER(@InputString) set @TempString = replace(@TempString, 'A', '') set @TempString = replace(@TempString, 'E', '') set @TempString = replace(@TempString, 'I', '') set @TempString = replace(@TempString, 'O', '') set @TempString = replace(@TempString, 'U', '')
in dbo.CompareText()
That, doe$sn^t re@m0ve no!se ch@ra)ters. I+t jus/t rem(o)ves v_owels.
Boycotted Beijing Olympics 2008 |
 |
|
|
blindman
Flowing Fount of Yak Knowledge
USA
2365 Posts |
Posted - 09/25/2008 : 01:28:52
|
Astounding. Until now, the realm of DBAs has been nearly devoid of business buzzwords. But Certus, in a single thread, has greatly expanded our lexicon. Little Gems such as "Pactory", "Tractory", "Enactory", and "Exactory" start showing up around post #64, and he throws in "heterarchically" later on. Thanks to his "EAV On Steroids" database design, we can finally hold our own when talking to mid-level managers. http://www.dbforums.com/showthread.php?t=1633864&page=5
Boycotted Beijing Olympics 2008 |
 |
|
|
Arnold Fribble
Yak-finder General
United Kingdom
1961 Posts |
Posted - 09/25/2008 : 08:27:24
|
But it leaves so many questions unanswered! What about the semantics in the underlying model theory? What notions of reification are there? How does that link in with context and provenance? (Actually, it's quite possible these were all discussed: I didn't read any more than the posts on the linked page).
|
Edited by - Arnold Fribble on 09/25/2008 08:29:51 |
 |
|
|
blindman
Flowing Fount of Yak Knowledge
USA
2365 Posts |
Posted - 09/25/2008 : 08:43:44
|
I suspect he is developing some kind of super "Entity Attribute Vocabulary" (EAV), where words themselves have no meaning except in relation to other words, thus saving us the tedious overhead of dictionaries. Now, anybody will be able to define any word to mean anything they want, without having to worry about restrictions such as grammar or spelling. Eventually, we will only need one word: "Marklar".
Boycotted Beijing Olympics 2008 |
 |
|
|
LaurieCox
Posting Yak Master
USA
125 Posts |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
USA
6997 Posts |
Posted - 09/25/2008 : 10:51:54
|
quote: Originally posted by blindman
Astounding. Until now, the realm of DBAs has been nearly devoid of business buzzwords. But Certus, in a single thread, has greatly expanded our lexicon. Little Gems such as "Pactory", "Tractory", "Enactory", and "Exactory" start showing up around post #64, and he throws in "heterarchically" later on. Thanks to his "EAV On Steroids" database design, we can finally hold our own when talking to mid-level managers. http://www.dbforums.com/showthread.php?t=1633864&page=5
Boycotted Beijing Olympics 2008
That "design" seems perfectly engineered to generate a steady stream of consulting revenue.
I’m sure we will soon get posts where someone tries to implement it in SQL Server. "Help, every query I write with this database is 4,000 lines long, takes days to run, and tells me my inventory quantity on-hand is “Light Blue".
Edit: Has anyone ever mentioned to the EVA designers that SQL Server has all that stuff built-in and supported directly by the database engine: sysobjects, syscolumns, systypes, sysreferences, sysconstraints, etc. Just saying...
CODO ERGO SUM |
Edited by - Michael Valentine Jones on 09/25/2008 11:03:43 |
 |
|
|
blindman
Flowing Fount of Yak Knowledge
USA
2365 Posts |
Posted - 09/25/2008 : 10:57:26
|
...or help requests such as "How can I enactor my pactors?"
Boycotted Beijing Olympics 2008 |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
|
|
tosscrosby
Aged Yak Warrior
USA
676 Posts |
Posted - 09/26/2008 : 09:08:57
|
quote: Originally posted by Michael Valentine Jones
Just sad. Why do people keep trying to help this guy? http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=110081
You might as well try to teach SQL to your dog. At least your dog wouldn't be rude.
CODO ERGO SUM
That's why it's a good thing that lions eat their young....Weed out the weaklings!
Terry |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47099 Posts |
|
|
uberman
Posting Yak Master
153 Posts |
|
|
RickD
Slow But Sure Yak Herding Master
United Kingdom
3560 Posts |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
USA
6997 Posts |
|
|
DavidChel
Constraint Violating Yak Guru
USA
474 Posts |
Posted - 11/12/2008 : 17:02:51
|
| visakh16 is a saint. |
 |
|
|
spirit1
Cybernetic Yak Master
Slovenia
11741 Posts |
Posted - 11/12/2008 : 18:26:56
|
probably just wants to claim Peso's title  
_______________________________________________ Causing trouble since 1980 Blog: http://weblogs.sqlteam.com/mladenp Speed up SSMS development: www.ssmstoolspack.com <- version 1.1 out! |
Edited by - spirit1 on 11/12/2008 18:27:07 |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
|
Topic  |
|