-
Notifications
You must be signed in to change notification settings - Fork 270
Frame ID reset during looping #166
Comments
I am not sure what you mean by "frame id reset". Could you provide an example? |
When viewing the output using doc.frame, the frame id in each mention is a
running counter. However, if you loop through the mentions individually,
the frame id starts from 1 for each mention. This doesn't allow linking the
references.
…On 17 Apr 2018 17:54, "Michael Ringgaard" ***@***.***> wrote:
I am not sure what you mean by "frame id reset". Could you provide an
example?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#166 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AkrnR8xf8dd7Z-3jsmlntIXf1n2NF3lpks5tpd76gaJpZM4TYL0G>
.
|
I assume you are doing this from Python. The "frame id" is just a reference that is added to anonymous frames so you can refer to them from other frames. These ids are generated by the frame serialization and is not a permanent part of the frame. The frames form a graph which you can traverse, and you can just compare the frames to see if they are the same (PyFrame supports "rich compare"). You don't need the ids for this. |
Can you give an example? I did not find anything relevant on the net.
Appreciate the help.
…On Wed, Apr 18, 2018 at 9:39 PM, Michael Ringgaard ***@***.*** > wrote:
I assume you are doing this from Python. The "frame id" is just a
reference that is added to anonymous frames so you can refer to them from
other frames. These ids are generated by the frame serialization and is not
a permanent part of the frame. The frames form a graph which you can
traverse, and you can just compare the frames to see if they are the same
(PyFrame supports "rich compare"). You don't need the ids for this.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#166 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AkrnR78pMP6ljqyybSdCgUeMwpaempnXks5tp2U3gaJpZM4TYL0G>
.
|
The frames in a store basically form a graph so when you want to serialize some of these to text all the (anonymous) frames are numbered consecutively as they are output, and if there is a back pointer, it will just output a reference to the frame. Here is a simple example of parsing some text and traversing the mentions and frames output:
However, I am stil not sure what your problem is. Maybe you could provide an example of the problem you encounter. |
Is there a way to extract relations and triples from the graph (formed by
frames)?
…On 28 Apr 2018 04:09, "Michael Ringgaard" ***@***.***> wrote:
The frames in a store basically form a graph so when you want to serialize
some of these to text all the (anonymous) frames are numbered consecutively
as they are output, and if there is a back pointer, it will just output a
reference to the frame.
Here is a simple example of parsing some text and traversing the mentions
and frames output:
import sling
parser = sling.Parser("local/sempar.flow")
n_isa = parser.commons['isa']
n_name = parser.commons['name']
while True:
text = raw_input('Enter text: ')
if text == 'quit': break;
doc = parser.parse(text)
print "Text:", doc.phrase(0, len(doc.tokens))
for mention in doc.mentions:
for e in mention.evokes():
if n_name not in e:
e.name = doc.phrase(mention.begin, mention.end)
for mention in doc.mentions:
print "mention", doc.phrase(mention.begin, mention.end)
for e in mention.evokes():
print " evoke", e[n_isa].name, e
for r,v in e:
if 'description' in r:
print " role", r.description, v
print
However, I am stil not sure what your problem is. Maybe you could provide
an example of the problem you encounter.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#166 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AkrnR6A2RCayxOGCFPrV5r63yjI4bIizks5ts54tgaJpZM4TYL0G>
.
|
A semantic frame can be viewed as a N-way relation between the role fillers. A (subject, predicate, object) triple is encoded as {:predicate subject: {...} object: {...}}. |
How do I import Sling output into a graph?
…On 30 Apr 2018 16:40, "Michael Ringgaard" ***@***.***> wrote:
A semantic frame can be viewed as a N-way relation between the role
fillers. A (subject, predicate, object) triple is encoded as {:predicate
subject: {...} object: {...}}.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#166 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AkrnR2rTcy4sO2E1gC26fihWEjhKQ6ymks5ttvEdgaJpZM4TYL0G>
.
|
The SLING output is a graph. The syntax is like JSON, but with a few extensions (see here). Each frame is a node in the graph, and each frame slot is an edge in the graph. Here is a simple example of the SLING output from the parser:
For example, frame 13 is a node in the graph:
The id if the frame is 13 (
A SLING store is a semantic frame store, but this is basically equivalent to a graph. You can read and write frame graphs using the Python SLING API in either text or binary encoded form:
|
Hello Michael,
I parsed it using regex. Other methods did not work. Are you planning to
release any other version of semantic parser in the near future?
Regards
Amit
…On Thu, Aug 30, 2018 at 9:38 PM Michael Ringgaard ***@***.***> wrote:
Closed #166 <#166>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#166 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AkrnR_KErkUQWRnqXHki3W3iZbHyhXG7ks5uWA31gaJpZM4TYL0G>
.
|
We are planning to release version 2 of the semantic parser later this year, based on the caspar branch. |
Great. I look forward to it. Thanks for your help.
…On Fri, Aug 31, 2018 at 1:17 PM Michael Ringgaard ***@***.***> wrote:
We are planning to release version 2 of the semantic parser later this
year, based on the caspar branch.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#166 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AkrnR_GvaGK49wGjYAb20ppzSvHCFcVDks5uWOofgaJpZM4TYL0G>
.
|
Is there a way to extract the Frame IDs at the document level? At any other level, the frame IDs start from 1. This makes it difficult to link the text.
The text was updated successfully, but these errors were encountered: