English 中文(简体)
图表——我如何利用树木伊索吗?
原标题:graph - How do I use Tree Isomorphic to solve language pattern matching?

Algorithm Design Manual上,它说:

你们是否测试了两 trees吗? 某些特殊的图表非形态学案例,如树木和图表,则算得更快。 Perhaps 最重要的案例是发现树木中的异构体,这个问题产生于语言模式()和教化应用。 par树常常用来描述案文的结构;如果案文的底部结构相同,则两根树不会变形。

我只想给我一个例子,说明如何利用树木伊索吗.解决语言模式配对问题。 i.e. 我如何规划与树木吗morph问题相匹配的语言模式?

Normally, how do I construct a string or text as a tree and compare their identities?

成就

最佳回答

以英语为例,认为某些英文判决可以用以下树种来表述:

        SENTENCE               SENTENCE
       /                     /        
  PROPER NOUN  VERB      COMMON NOUN  VERB
      /                    /    
     NAME                ARTICLE NOUN

英文本中的“The dog barks”短语如下:

ARTICLE    NOUN      VERB
 /          /         /
The       dog       barks

    COMMON NOUN
     /      
ARTICLE    NOUN      VERB
 /          /         /
The       dog       barks


            SENTENCE
             /     
    COMMON NOUN     
     /              
ARTICLE    NOUN      VERB
 /          /         /
The       dog       barks

同一结构的另一句是“一页”。 树木的树冠以同样的形式,这意味着两根树的形态不会变形。 也就是说,尽管含义不同,但它们的逻辑结构与判决相同。

            SENTENCE
             /     
    COMMON NOUN     
     /              
ARTICLE    NOUN      VERB
 /          /         /
A         leaf      falls

如果你无视实际的言辞,两根树也是一般形态的吗.,也是树木。

问题回答

如案文所示,parsemoto是此处的关键概念。 par树(在某种程度上)代表一种案文的结构,它is/strong>。 从技术上讲,你可以使用你喜欢的任何树木算法,与树林合作。

Parse tree is an ordered, rooted tree that represents the syntactic structure of a string according to some formal grammar.

(Wikipedia article on 树林





相关问题
How to add/merge several Big O s into one

If I have an algorithm which is comprised of (let s say) three sub-algorithms, all with different O() characteristics, e.g.: algorithm A: O(n) algorithm B: O(log(n)) algorithm C: O(n log(n)) How do ...

Grokking Timsort

There s a (relatively) new sort on the block called Timsort. It s been used as Python s list.sort, and is now going to be the new Array.sort in Java 7. There s some documentation and a tiny Wikipedia ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Enumerating All Minimal Directed Cycles Of A Directed Graph

I have a directed graph and my problem is to enumerate all the minimal (cycles that cannot be constructed as the union of other cycles) directed cycles of this graph. This is different from what the ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...