Converting a Natural Language Parse Tree to Notation3

View: New views
7 Messages — Rating Filter:   Alert me  

Converting a Natural Language Parse Tree to Notation3

by Cerin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I apologize if this isn't the place for N3 questions, but I can't seem
to find a dedicated public forum for N3.

Is N3 descriptive enough to represent an arbitrarily complex parse
tree for a sentence? I've been reading over the spec, but I'm finding
it a little unintuitive, and most of the examples don't approach the
complexity of natural language.

I'm curious to see if I can take natural language text, generate a
parse tree, and convert it into N3, which I can then more easily query
using a semantic reasoner like CWM.

For example, given the lengthy sentence, "The meeting of the
shareholders of the company shall be held at a place deemed
appropriate by a majority vote of the shareholders, to be determined
no less then a month before the meeting and no more than 6 months
before the meeting", how would that look in N3?

I think I grasp the "x of y of z" form to look like :z!:y!:x in N3,
and simple SVO forms to look like ":s :v :o" in N3, but I don't see
how more complicated nested structures would look. How does N3
represent prepositions like "at" and "to", nested triples, or logical
AND and OR statements? Is there an existing namespace for common
English vocabulary, like "determined", "before", etc?

Regards,
Chris


Re: Converting a Natural Language Parse Tree to Notation3

by timrdf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

(List folk: please let us know if this is off topic for this list)

Chris,

Do you have any current non-N3 representations of your example sentence?

I am not familiar with building parse trees, but if you have a current
format I'd be show you a N3-version of it.

Regards,
Tim Lebo

On Thu, Oct 15, 2009 at 11:07 AM, Chris Spencer <chrisspen@...> wrote:

> I apologize if this isn't the place for N3 questions, but I can't seem
> to find a dedicated public forum for N3.
>
> Is N3 descriptive enough to represent an arbitrarily complex parse
> tree for a sentence? I've been reading over the spec, but I'm finding
> it a little unintuitive, and most of the examples don't approach the
> complexity of natural language.
>
> I'm curious to see if I can take natural language text, generate a
> parse tree, and convert it into N3, which I can then more easily query
> using a semantic reasoner like CWM.
>
> For example, given the lengthy sentence, "The meeting of the
> shareholders of the company shall be held at a place deemed
> appropriate by a majority vote of the shareholders, to be determined
> no less then a month before the meeting and no more than 6 months
> before the meeting", how would that look in N3?
>
> I think I grasp the "x of y of z" form to look like :z!:y!:x in N3,
> and simple SVO forms to look like ":s :v :o" in N3, but I don't see
> how more complicated nested structures would look. How does N3
> represent prepositions like "at" and "to", nested triples, or logical
> AND and OR statements? Is there an existing namespace for common
> English vocabulary, like "determined", "before", etc?
>
> Regards,
> Chris
>
>


Re: Converting a Natural Language Parse Tree to Notation3

by Cerin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 15, 2009 at 11:36 AM, Tim rdf <timrdf@...> wrote:

> (List folk: please let us know if this is off topic for this list)
>
> Chris,
>
> Do you have any current non-N3 representations of your example sentence?
>
> I am not familiar with building parse trees, but if you have a current
> format I'd be show you a N3-version of it.
>
> Regards,
> Tim Lebo

Thanks. I'm not sure what the definitive parsing would be, but below
is a manual parsing edited from the chunked output from MontyLingua.

I've formatted it to appear as an s-expression, indented for clarity,
but I apologize if the indentation is lost in the email.

(S
    (NP
        The/DT
        meeting/NN
        (PP
            of/IN
            (NP
                the/DT
                shareholders/NNS
                (PP
                    of/IN
                    (NP
                        the/DT
                        company/NN
                    )
                )
            )
        )
    )
    (VA
        (VP
            shall/MD
            be/VB
            held/VBN
        )
        (PP
            at/IN
            (NP
                a/DT
                place/NN
                (VA
                    (VP
                        deemed/VBN
                    )
                    (NP
                        appropriate/JJ
                        (PP
                            by/IN
                            (NP
                                a/DT
                                majority/JJ
                                vote/NN
                                (PP
                                    of/IN
                                    (NP
                                        the/DT
                                        shareholders/NNS
                                    )
                                )
                                (PP
                                    to/TO
                                    (VA
                                        (VP
                                            be/VB
                                            determined/VBN
                                        )
                                        (NP
                                            no/RB
                                            less/RBR
                                            (PP
                                                than/IN
                                                (NP
                                                    a/DT
                                                    month/NN
                                                    (PP
                                                        before/IN
                                                        (NP
                                                            the/DT
                                                            meeting/NN
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                        (NP
                                            and/CC
                                            no/DT
                                            more/JJR
                                            (PP
                                                than/IN
                                                (NP
                                                    six/CD
                                                    months/NNS
                                                    (PP
                                                        before/IN
                                                        (NP
                                                            the/DT
                                                            meeting/NN
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )
)

Regards,
Chris


Parent Message unknown Re: Converting a Natural Language Parse Tree to Notation3

by Cerin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 16, 2009 at 10:37 AM, naudts guido
<naudts_vannoten@...> wrote:
> Hallo,
> this can be converted to N3 in the following manner:
> [:node "some_node eg VP"; :parentNode "parentNode1; :children ("childnode1" ..."childNoden")].
> Then you can query eg give all childnodes of VP:
> [:node "VP"; :children ?a].
> where ?a will be replaced by the children.
> (I translate XML to N3 in this manner).
> Of course you can easily add other characteristics to a node.
> With kind regards,

Interesting, thanks.

Just to clarify though, are you using the grammar tags as unique
identifiers? Isn't this impossible, since multiple nodes use the same
grammar tags (e.g. there are multiple VP nodes)?

Wouldn't you instead store the grammar tag in a separate attribute like:
[:node "2103738"; :tag "VP"; :parentNode "9073"; :children("98732987"
"342323241" ...)]

and then query it like:
[:node ?a; :tag "VP"; :children ?a]
?

Regards,
Chris


Re: Converting a Natural Language Parse Tree to Notation3

by timrdf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I would:
1) avoid bothering with minting number IDs for each node; just let
the bnode carry it.
2) Use 'a' instead of :tag.

               (PP
                   of/IN
                   (NP
                       the/DT
                       company/NN
                   )
               )

@prefix pos: <http://eg.com/parts-of-speech#>

[ a pos:PP;
  pos:comprises (
    [ pos:string "of"; a pos:IN ]
    ( a pos:NP;
        pos:comprises (
            [ pos:string "the"; a pos:DT ]
            [ pos:string "company"; a pos:NN ]
        )
    )
 )
] .



-Tim


On Fri, Oct 16, 2009 at 11:27 AM, Chris Spencer <chrisspen@...> wrote:

> On Fri, Oct 16, 2009 at 10:37 AM, naudts guido
> <naudts_vannoten@...> wrote:
>> Hallo,
>> this can be converted to N3 in the following manner:
>> [:node "some_node eg VP"; :parentNode "parentNode1; :children ("childnode1" ..."childNoden")].
>> Then you can query eg give all childnodes of VP:
>> [:node "VP"; :children ?a].
>> where ?a will be replaced by the children.
>> (I translate XML to N3 in this manner).
>> Of course you can easily add other characteristics to a node.
>> With kind regards,
>
> Interesting, thanks.
>
> Just to clarify though, are you using the grammar tags as unique
> identifiers? Isn't this impossible, since multiple nodes use the same
> grammar tags (e.g. there are multiple VP nodes)?
>
> Wouldn't you instead store the grammar tag in a separate attribute like:
> [:node "2103738"; :tag "VP"; :parentNode "9073"; :children("98732987"
> "342323241" ...)]
>
> and then query it like:
> [:node ?a; :tag "VP"; :children ?a]
> ?
>
> Regards,
> Chris
>
>


Re: Converting a Natural Language Parse Tree to Notation3

by Cerin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Tim! That clarifies a lot.

Regards,
Chris

On Fri, Oct 16, 2009 at 12:12 PM, Tim rdf <timrdf@...> wrote:

> I would:
> 1) avoid bothering with minting number IDs for each node; just let
> the bnode carry it.
> 2) Use 'a' instead of :tag.
>
>               (PP
>                   of/IN
>                   (NP
>                       the/DT
>                       company/NN
>                   )
>               )
>
> @prefix pos: <http://eg.com/parts-of-speech#>
>
> [ a pos:PP;
>  pos:comprises (
>    [ pos:string "of"; a pos:IN ]
>    ( a pos:NP;
>        pos:comprises (
>            [ pos:string "the"; a pos:DT ]
>            [ pos:string "company"; a pos:NN ]
>        )
>    )
>  )
> ] .
>
>
>
> -Tim
>
>
> On Fri, Oct 16, 2009 at 11:27 AM, Chris Spencer <chrisspen@...> wrote:
>> On Fri, Oct 16, 2009 at 10:37 AM, naudts guido
>> <naudts_vannoten@...> wrote:
>>> Hallo,
>>> this can be converted to N3 in the following manner:
>>> [:node "some_node eg VP"; :parentNode "parentNode1; :children ("childnode1" ..."childNoden")].
>>> Then you can query eg give all childnodes of VP:
>>> [:node "VP"; :children ?a].
>>> where ?a will be replaced by the children.
>>> (I translate XML to N3 in this manner).
>>> Of course you can easily add other characteristics to a node.
>>> With kind regards,
>>
>> Interesting, thanks.
>>
>> Just to clarify though, are you using the grammar tags as unique
>> identifiers? Isn't this impossible, since multiple nodes use the same
>> grammar tags (e.g. there are multiple VP nodes)?
>>
>> Wouldn't you instead store the grammar tag in a separate attribute like:
>> [:node "2103738"; :tag "VP"; :parentNode "9073"; :children("98732987"
>> "342323241" ...)]
>>
>> and then query it like:
>> [:node ?a; :tag "VP"; :children ?a]
>> ?
>>
>> Regards,
>> Chris
>>
>>
>


Re: Converting a Natural Language Parse Tree to Notation3

by naudts guido :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hallo,
I have nothing to add to the remarks of Tim;
right to the point!
Guido

 
Guido Naudts
Lic. zoologie
Ir.informatica
Adviseur Department of Justice
Secretarisdreef 5
2288 Bouwel
Belgium



----- Original Message ----
From: Tim rdf <timrdf@...>
To: Chris Spencer <chrisspen@...>
Cc: naudts guido <naudts_vannoten@...>; public-cwm-talk@...
Sent: Fri, October 16, 2009 6:12:46 PM
Subject: Re: Converting a Natural Language Parse Tree to Notation3

I would:
1) avoid bothering with minting number IDs for each node; just let
the bnode carry it.
2) Use 'a' instead of :tag.

               (PP
                   of/IN
                   (NP
                       the/DT
                       company/NN
                   )
               )

@prefix pos: <http://eg.com/parts-of-speech#>

[ a pos:PP;
  pos:comprises (
    [ pos:string "of"; a pos:IN ]
    ( a pos:NP;
        pos:comprises (
            [ pos:string "the"; a pos:DT ]
            [ pos:string "company"; a pos:NN ]
        )
    )
)
] .



-Tim


On Fri, Oct 16, 2009 at 11:27 AM, Chris Spencer <chrisspen@...> wrote:

> On Fri, Oct 16, 2009 at 10:37 AM, naudts guido
> <naudts_vannoten@...> wrote:
>> Hallo,
>> this can be converted to N3 in the following manner:
>> [:node "some_node eg VP"; :parentNode "parentNode1; :children ("childnode1" ..."childNoden")].
>> Then you can query eg give all childnodes of VP:
>> [:node "VP"; :children ?a].
>> where ?a will be replaced by the children.
>> (I translate XML to N3 in this manner).
>> Of course you can easily add other characteristics to a node.
>> With kind regards,
>
> Interesting, thanks.
>
> Just to clarify though, are you using the grammar tags as unique
> identifiers? Isn't this impossible, since multiple nodes use the same
> grammar tags (e.g. there are multiple VP nodes)?
>
> Wouldn't you instead store the grammar tag in a separate attribute like:
> [:node "2103738"; :tag "VP"; :parentNode "9073"; :children("98732987"
> "342323241" ...)]
>
> and then query it like:
> [:node ?a; :tag "VP"; :children ?a]
> ?
>
> Regards,
> Chris
>
>