English 中文(简体)
如何计算两种判决之间的相似性(战术和异常)
原标题:How to compute similarity between two sentences (syntactical and semantical)

我本应每次两句,如果两句类似的话,将予以赞扬。 同样,我直截了当地和 se。

INPUT1: Obama signs the law. A new law is signed by Obama.

INPUT2: A Bus is stopped here. A vehicle stops here.

INPUT3: Fire in NY. NY is burnt down.

INPUT4: Fire in NY. 50 died in NY fire.

我不想把肿瘤树当作灵魂。 我写了一部法典,对以下各点进行补充:http://en.wikipedia.org/wiki/Levenshtein_distance” rel=“nofollow noreferer”>Levenshtein long(LD)在判决之间,然后决定第二句是否:

  • can be ignored (INPUT1 and 2),
  • should replace the first sentence (INPUT 3), or
  • store along with the first sentence (INPUT4).

我不赞成《刑法》,因为《刑法》只是贬低行为水平(其他方法是什么?)。 如何吸收杂质(如公共汽车是一种车辆?) 。

守则如下:

%# As the difference is computed, a decision is made on the new event
%# (string 2) to be ignored, to replace existing event (string 1) or to be
%# stored separately. The higher the LD metric, the higher the difference
%# between two strings. Of course, lower difference indices either identical
%# or similar events. However, the higher difference indicates the new event
%# as a fresh event.

%#.........................................................................
%# Calculating the LD between two strings of events.
%#.........................................................................
L1=length(str1)+1;
L2=length(str2)+1;
L=zeros(L1,L2);   %# Initializing the new length.

g=+1;             %# just constant
m=+0;             %# match is cheaper, we seek to minimize
d=+1;             %# not-a-match is more costly.

% do BC s
L(:,1)=([0:L1-1]*g) ;
L(1,:)=[0:L2-1]*g;

m4=0;             %# loop invariant
%# Calculating required edits.
for idx=2:L1;
    for idy=2:L2
        if(str1(idx-1)==str2(idy-1))
            score=m;
        else
            score=d;
        end
        m1=L(idx-1,idy-1) + score;
        m2=L(idx-1,idy) + g;
        m3=L(idx,idy-1) + g;
        L(idx,idy)=min(m1,min(m2,m3)); % only minimum edits allowed.
    end
end
%# The LD between two strings.
D=L(L1,L2);

%#....................................................................
%# Making decision on what to do with the new event (string 2).
%#...................................................................
if (D<=4)     %# Distance is so less that string 2 seems identical to string 1.
    store=str1;        %# Hence string 2 is ignored. String 1 remains stored.
elseif (D>=5 && D<=15) %# Distance is larger to be identical but not enough to
    %# make string 2 an individual event.
    store= str2;       %# String 2 is somewhat similar to string 1.
                       %# So, string 1 is replaced with string 2 and stored.
else
    %# For all other distances, string 2 is stored along with string 1.
    store={str1; str2};
end

感谢任何帮助。

最佳回答

“岛屿”。 没有简单的教科书算法。 自然语言(英文)是一个非常复杂和非常复杂的东西。 3. 请看(占案件总数的一小部分):

INPUT1: Obama signs the law. A new law is signed by Obama.

签署一项法律使之成为一项新法律。

INPUT2: A Bus is stopped here. A vehicle stops here.

如果车辆和某种时间关系,需要知道公共汽车是一种类型。 另外,如果公共汽车did? 停下来,但通常不会停止或不再停止? 可以采取几种方式。

INPUT3: Fire in NY. NY is burnt down.

需要知道,火烧可以烧毁。

INPUT4: Fire in NY. 50 died in NY fire.

需要知道火灾会杀东西(见下文)。 需要将“新闻标题”(50WHAT)与人们联系起来。 脑能稍微少地做到这一点。 计算机程序不是大脑。

页: 1

问题回答

暂无回答




相关问题
What is this C++ Syntax when declaring a class?

I occasionally run into this type of syntax when looking through open source code and was wondering what it s for, or what it s even called for that matter. I have crawled the internet many a times ...

RoR define meaningful relations between two models

i want to define a many-to-many relation in a rails project. how is the best way to give the individual relations different meanings? +------------+ has many +-------------+ | ...

Opinion Mining - What Database Type?

I am entering a project to make a Opinion Mining (Data Mining -> Web Mining -> Opinion Mining) to get semantic orientation of the words contained. We will use a crawler to get the pages opinion. Now ...

Google Semantic results question

http://www.google.co.uk/search?q=mark+zuckerberg+crunchbase Guys, check out that search, in particular the first result s url. Crunchbase.com > People, and thus the people links to the /people ...