Message Boards Message Boards

0
|
8613 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Get the graph from a sentence? Playing with TextStructure

Posted 8 years ago

Let's say you have the sentence:

t2 = "The alcohol evaporated because the temperature was so high"

"TextStructure", an experimental function, provides a beautiful sentence constituent graph:

gt2 = TextStructure[t2,"ConstituentGraphs"]

Sentence t2 graph

However, gt2 is not a Graph: GraphQ[gt2] gives a "False" result. In order to have it as a graph, I have to manually select the graph and copy it as "Input Text".

My question is: how do I make this process of converting the picture to a graph using commands instead of manually?

POSTED BY: Jorge Mahecha
2 Replies

That helps a lot, you just made a person very happy today Wilson. Now I can compute all sort of Graph properties on this. My best regards,

Jorge

POSTED BY: Jorge Mahecha
Posted 8 years ago

Hi Jorge,

If you take a look at the following:

FullForm[gt2]

You will see that gt2 is indeed a Graph except it is enclosed by List. This will return True

GraphQ[gt2[[1]]]

Hope that helps.

Wilson

POSTED BY: Wilson Kan
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract