how detect english subject and predicate in a sentence

J

Jack

Hi there, just checking to see if anyone knows how to perform this
basic grammar function ? I searched CPAN and found nothing that was
able to in Perl..

Thank you,

Jack
 
C

Charlton Wilbur

J> Hi there, just checking to see if anyone knows how to perform
J> this basic grammar function ? I searched CPAN and found nothing
J> that was able to in Perl..

That's because it's not a trivial problem.

Consider: "Time flies like an arrow. Fruit flies like a banana."

In the second sentence, what is the subject?

Charlton
 
J

Jack

    J> Hi there, just checking to see if anyone knows how to perform
    J> this basic grammar function ?  I searched CPAN and found nothing
    J> that was able to in Perl..

That's because it's not a trivial problem.

Consider: "Time flies like an arrow.  Fruit flies like a banana."

In the second sentence, what is the subject?

Charlton

Thanks.. So my goal would be to capture what is the subject of the
sentence, Time, and Fruit, respectively. However you cant always take
the first noun that shows up as the subject for instance: "Despite
accusations, lawyers find a way to evade difficult situations"

Lawyers would be the subject of the sentence.. does that make sense ?
Essentially, identify the TOPIC/subject is what I want to do, for a
given sentence..
 
J

Jürgen Exner

Jack said:
Thanks.. So my goal would be to capture what is the subject of the
sentence, Time, and Fruit, respectively. However you cant always take

You just proved Charlton's point:
In the second sentence the subject is not "fruit" but "fruit flies"

Natural language parsing is a _very_ difficult subject.

jue
 
C

Charlton Wilbur

J> You just proved Charlton's point: In the second sentence the
J> subject is not "fruit" but "fruit flies"

And you just proved my actual point: Whether the subject is "fruit" or
"fruit flies" is indeterminate, and that's where the humor in the
statement comes from.

Charlton
 
T

Ted Zlatanov

J> Hi there, just checking to see if anyone knows how to perform this
J> basic grammar function ? I searched CPAN and found nothing that was
J> able to in Perl..

If you can limit the input, you're better off. IOW, make your input
conform to some basic templates and then guess from that template.
Otherwise you won't solve it with CPAN, although there are quite a few
commercial NLP products.

What is your real goal? Are you trying to find something in the text,
or accept input to tell you what to do, or analyzing it statistically,
or something else? Each one of those has a specific set of solutions we
can recommend, but there's no generic solution. Language is just too
complex. Don't forget people can use bad grammar, malformed sentences,
misspell, and use English dialects or made-up words.

Ted
 
J

Jack

J> Hi there, just checking to see if anyone knows how to perform this
J> basic grammar function ?  I searched CPAN and found nothing that was
J> able to in Perl..

If you can limit the input, you're better off.  IOW, make your input
conform to some basic templates and then guess from that template.
Otherwise you won't solve it with CPAN, although there are quite a few
commercial NLP products.

What is your real goal?  Are you trying to find something in the text,
or accept input to tell you what to do, or analyzing it statistically,
or something else?  Each one of those has a specific set of solutions we
can recommend, but there's no generic solution.  Language is just too
complex.  Don't forget people can use bad grammar, malformed sentences,
misspell, and use English dialects or made-up words.

Ted

Thanks all.

I want to know the topical NOUN of the sentence. Not nouns that
happen to supplement elsewhere in the sentence. In "fruit flies like
a banana" - the key or topical noun is 'fruit' NOT banana yet both are
nouns...just 1 example. It should answer which noun reveals the focal
point, indicating what the sentence is about (fruit in the above
case). Does that make sense.

Thank you,
Jack
 
J

Jack

Thanks all.

I want to know the topical NOUN of the sentence.  Not nouns that
happen to supplement elsewhere in the sentence.  In "fruit flies like
a banana" - the key or topical noun is 'fruit' NOT banana yet both are
nouns...just 1 example.  It should answer which noun reveals the focal
point, indicating what the sentence is about (fruit in the above
case).  Does that make sense.

Thank you,
Jack- Hide quoted text -

- Show quoted text -

In other words, step 1 in the process to me is - "what" is it we are
talking about ? This is the most basic question. "What" is the noun
subject of the sentence? Step 2 being, descriptive support,
adjectives, etc. about "it". Just trying to get to step 1 !
 
R

RedGrittyBrick

Jack said:
Thanks all.

I want to know the topical NOUN of the sentence. Not nouns that
happen to supplement elsewhere in the sentence. In "fruit flies like
a banana" - the key or topical noun is 'fruit' NOT banana yet both are
nouns...

How about "flies" as a plural noun?

just 1 example. It should answer which noun reveals the focal
point, indicating what the sentence is about (fruit in the above
case). Does that make sense.

Not to me.

http://www.skotos.net/articles/dawnof15.shtml
 
T

Ted Zlatanov

J> I want to know the topical NOUN of the sentence. Not nouns that
J> happen to supplement elsewhere in the sentence. In "fruit flies like
J> a banana" - the key or topical noun is 'fruit' NOT banana yet both are
J> nouns...just 1 example. It should answer which noun reveals the focal
J> point, indicating what the sentence is about (fruit in the above
J> case). Does that make sense.

No, I understand that your immediate technical goal is to find the noun.
Your wider goal seems to be the topic of the sentence.

I'm asking why you want to find the noun/topic. What will you do with
this information? Is it a *command* or a *source of statistics* or a
*classification* or something else? Any one of those things has
specific ways to be done we can recommend rather than solving the
immediate technical goal, which as several have mentioned is very
difficult.

Ted
 
S

Scott Bryce

Jack said:
I want to know the topical NOUN of the sentence. Not nouns that
happen to supplement elsewhere in the sentence. In "fruit flies like
a banana" - the key or topical noun is 'fruit' NOT banana yet both
are nouns...just 1 example.

This is an example which points out how difficult the task is. "Fruit"
is NOT the topic of the sentence. "flies" is. "Fruit" tells us what type
of flies like bananas.

If YOU cannot determine the subject of the sentence, how do you expect
to write code that determines the subject of the sentence?
 
C

Charlton Wilbur

SB> This is an example which points out how difficult the task
SB> is. "Fruit" is NOT the topic of the sentence. "flies"
SB> is. "Fruit" tells us what type of flies like bananas.

Actually, the sentence can be read *correctly* in two incompatible ways.
You can read "Fruit flies" as the subject, and "like a banana" as the
predicate, or "Fruit" as the subject, and "flies like a banana" as the
predicate. Both readings are correct.

Structurally, it's identical to the former sentence in the statement:
"Time flies like an arrow." But because there is no such thing as a
"time fly," there's only one reading that makes sense.

In other words, you can't determine what the subject of the sentence is
without knowledge of the semantic content.

SB> If YOU cannot determine the subject of the sentence, how do you
SB> expect to write code that determines the subject of the
SB> sentence?

This is, at its heart, the fundamental question.

Charlton
 
R

Randal L. Schwartz

J> Hi there, just checking to see if anyone knows how to perform
J> this basic grammar function ? I searched CPAN and found nothing
J> that was able to in Perl..

Charlton> That's because it's not a trivial problem.

Charlton> Consider: "Time flies like an arrow. Fruit flies like a banana."

Charlton> In the second sentence, what is the subject?

Keep in mind, the second sentence has *three* interesting interpretations:

(1) There are a kind of flies, called "fruit flies" that are attracted
to bananas.

(2) Fruit has aerodynamics that are similar to bananas.

(3) You are instructed to attack some flies by throwing fruit at them.
Do this as a banana might do it.

Granted, they have various levels of relative believability, but this
is not something you can simply regex.
 
S

sln

Hi there, just checking to see if anyone knows how to perform this
basic grammar function ? I searched CPAN and found nothing that was
able to in Perl..

Thank you,

Jack

Jack, whats the subject of this post?

sln
 
T

Tim Greer

Randal said:
(2) Fruit has aerodynamics that are similar to bananas.

I actually read it like that, genuinely. "Fruit" flies like a banana.
I'd have thought differently if it was phrased: "Fruit flies" like
bananas.
 
T

Ted Byers

    SB> Jack wrote:

    >> I want to know the topical NOUN of the sentence.  Not nouns that
    >> happen to supplement elsewhere in the sentence.  In "fruit flies
    >> like a banana" - the key or topical noun is 'fruit' NOT banana
    >> yet both are nouns...just 1 example.

    SB> This is an example which points out how difficult the task
    SB> is. "Fruit" is NOT the topic of the sentence. "flies"
    SB> is. "Fruit" tells us what type of flies like bananas.

Actually, the sentence can be read *correctly* in two incompatible ways.
You can read "Fruit flies" as the subject, and "like a banana" as the
predicate, or "Fruit" as the subject, and "flies like a banana" as the
predicate.  Both readings are correct.

Structurally, it's identical to the former sentence in the statement:
"Time flies like an arrow."  But because there is no such thing as a
"time fly," there's only one reading that makes sense.
Can we be sure of this? There is an important group of flies called
the ephemerata (includes crane flies). Who knows? Maybe some
entomologist with a perverse sense of humour labelled a new species of
ephemerata as the short time fly (the ephemerata live for about a day
as an adult, mate and die - they don't eat as adults - they're
ephemeral ...), and some other, longer lived species as a long time
fly. ;-) In a sense, one already did, albiet in another
language ... Or perhaps call a new species of fly 'time', so one can
refer to 'time' flying while you're having fun trying to catch it ...

heh, heh .... that's the sort of thing I'd do if I were lucky enough
to discover a new species of fly. one must try to inject a little fun
into work ...
In other words, you can't determine what the subject of the sentence is
without knowledge of the semantic content.  

    SB> If YOU cannot determine the subject of the sentence, how do you
    SB> expect to write code that determines the subject of the
    SB> sentence?

This is, at its heart, the fundamental question.

I do like the example provided because it is a simple, clear
illustration of the fact that natural language, unlike programming
languages, is multivocal. And one can have a bit of fun with it
too.

It is easy enough to find open source code that is useful for checking
spelling, but I wonder what it would take to put together a perl
script (perhaps using some of the lingua packages I installed today)
that classifies a statement in standard english as correct or
incorrect, and then proceeds to identify ambiguities related to a
given sentence having two or more legitimate readings (as determined
by syntax). I expect, though, that human intervention would be
required in all cases to determine which of several legitimate
readings is correct because one can not derive semantics from syntax
and as pointed out already one needs the semantics to determine which
reading of the sentence is correct (again the example provided shows
why syntax is insufficient to determine semantics).

Has anyone seen a perl script that can test a statement for
grammatical correctness, and multivocality?

Cheers,

Ted
 
S

sln

Can we be sure of this? There is an important group of flies called
the ephemerata (includes crane flies). Who knows? Maybe some
entomologist with a perverse sense of humour labelled a new species of
ephemerata as the short time fly (the ephemerata live for about a day
as an adult, mate and die - they don't eat as adults - they're
ephemeral ...), and some other, longer lived species as a long time
fly. ;-) In a sense, one already did, albiet in another
language ... Or perhaps call a new species of fly 'time', so one can
refer to 'time' flying while you're having fun trying to catch it ...

heh, heh .... that's the sort of thing I'd do if I were lucky enough
to discover a new species of fly. one must try to inject a little fun
into work ...


I do like the example provided because it is a simple, clear
illustration of the fact that natural language, unlike programming
languages, is multivocal. And one can have a bit of fun with it
too.

It is easy enough to find open source code that is useful for checking
spelling, but I wonder what it would take to put together a perl
script (perhaps using some of the lingua packages I installed today)
that classifies a statement in standard english as correct or
incorrect, and then proceeds to identify ambiguities related to a
given sentence having two or more legitimate readings (as determined
by syntax). I expect, though, that human intervention would be
required in all cases to determine which of several legitimate
readings is correct because one can not derive semantics from syntax
and as pointed out already one needs the semantics to determine which
reading of the sentence is correct (again the example provided shows
why syntax is insufficient to determine semantics).

Has anyone seen a perl script that can test a statement for
grammatical correctness, and multivocality?

Cheers,

Ted
You go Ted, you are da'man!

sln
 
S

sln

You go Ted, you are da'man!

sln

You know, usually these crackpot posts are aimed at the negative
of English grammar correctness.

After all, it isin't 'correct' English that is the problem, but
the interpretation of spam content emails.

There is NO INVERSE of correctness if it can't be systematically
defined in interpretation.

Thnaks, nice try Symantec. Hope your stocks rise above $.39 a share.


sln
 
R

RedGrittyBrick

Tim said:
I actually read it like that, genuinely. "Fruit" flies like a banana.
I'd have thought differently if it was phrased: "Fruit flies" like
bananas.

I'd find that odd. Since fruit is a well-known adjective for the noun
flies, I'd wonder if the quote marks were intended to convey irony. I
think it may only be the previous sentence that conditioned you to
interpret the second sentence in that particular way. It is often
presented as a garden path sentence -- in that it deliberately misleads.

--
RGB
The horse raced past the barn fell.
The car driven past the barn crashed.
The old man the boat.
The man whistling tunes pianos.
The cotton clothing is made of grows in Mississippi.
- Wikipedia.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top