From: Mark A. G. <ma...@dc...> - 2006-03-10 12:45:35
|
Hi, The only reason it would return null is if there aren't any annotations of type "semantics" in the set (for some strange reason it returns null in this situation rather than an empty AnnotationSet). What I don't understand is why there should be no annotations of type "semantics". When you print out just doc.getAnnotations() can you see the semantics annotations in among everything else? What happens if you try to get the "parse" annotations instead does this work or does this also fail? If both fail it suggests that the parse isn't working properly, are there any error messages appearing? Mark José M. Perea wrote: > Hi Mark, > > when I do a "System.out.println(doc.getAnnotations().get("semantics"));" it > shows null. However when I do "System.out.println(doc.getAnnotations());" it > shows all nodes on the screen. > > According to method summary of the gate interface AnnotationSet, the > "get(String type)" method returns a AnnotationSet (like > "doc.getAnnotations()")... > > Why it returns null? > > Thanks. >> Hi, >> Glad to hear you are making progress. >> >> As for viewing the syntax tree from the command line you will have to >> write some code as the viewer mentioned in Ian's mail is for GUI use only. >> >> The semantics are easy to get at - simply get the semantics annotations >> from the default AnnotationSet and then the data is stored in the qlf >> feature. Given an instance of Document you'd do something like >> >> AnnotationSet semantics = doc.getAnnotations().get("semantics"); >> >> You can then iterate over this set and for each annotation get the qlf like >> String qlf = annotation.getFeatures().get("qlf"); >> >> In the test suite this would get you the Strings >> >> pronoun(e3, this), number(e3, sing), be(e2), time(e2, present), >> aspect(e2, simple), voice(e2, active), lobj(e2, e4), sentence(e4), >> number(e4, sing), det(e4, a), realisation(e4, offsets(24, 34)), >> realisation(e2, offsets(21, 34)), realisation(e2, offsets(21, 34)), >> realisation(e3, offsets(16, 20)), lsubj(e2, e3) >> >> name(e1, '2 October 2004'), date(e1), realisation(e1, offsets(0, 14)) >> >> sentence(e5), number(e5, sing), det(e5, another), realisation(e5, >> offsets(44, 60)), time(e6, present), lsubj(e6, e5), be(e6), rule(sinv3b) >> >> Of course each annotation also contains information about the span of >> text each covers so you can get the text represented by each semantic >> annotation. >> >> For the syntax if you are happy with a Penn Tree Bank style bracketed >> structure then you do the same as above but get the parse annotation and >> the best_parse feature which gets you things like >> >> ( s ( dmp ( dt "this" ) ) ( fvp ( vp ( vpcore ( fvpcore ( >> nonmodal_vpcore ( nonmodal_vpcore1 ( vpcore1 ( av ( v "is" ) ) ) ) ) >> ) ) ( np ( bnp ( dt "a" ) ( bnp_core ( bnp_head ( n "sentence" ) ) ) >> ) ) ) ) ) >> >> If on the other hand you want some form of object structure then you can >> also get the SyntaxTreeNode annotations. Each syntax tree node has three >> features father, consists, cat. cat is simply the category of the node >> so POS tags or things like NP. Father is the ID of the SyntaxTreeNode >> which represents the parent of this node in the syntax tree, while >> consists is a list (I think or it could be an array) of Annotation IDs >> which represent the child nodes. So you can find root nodes by lookinf >> for those SyntaxTreeNodes which don't have a father, you can then build >> up a tree structure by following the consists features. >> >> Hope this helps, >> >> Mark >> >> José M. Perea wrote: >>> Hi Mark, >>> >>> thanks for all your help. It's a pleasure to work with people like you... >>> In the end I've been able to compile and to execute the TestSuite.java, >>> you don't ask to me how... (trying and trying...) >>> >>> My next question is: How can I show the syntax tree view and logic form >>> of the sentences with SUPPLE using command line? >>> >>> I've seen a mail on the mailing list that Ian Roberts responds: >>> >>> "To use the syntax tree viewer, make sure the Tools plugin is loaded, >>> then open a processed document and select the checkbox for "Sentence" >>> annotations in the annotations tree. Right click on one of the sentence >>> annotations in the table at the top and there should be an option to >>> 'Edit with syntax tree view' " >>> >>> but this is for GATE's GUI. I need to know how can I activate this for >>> runs my programs on command line. >>> >>> Once again, thanks for your support. >>> >>> >>> ------------------------------------------------------- >>> This SF.Net email is sponsored by xPML, a groundbreaking scripting >>> language that extends applications into web and mobile media. Attend the >>> live webcast and join the prime developer group breaking into this new >>> coding territory! >>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 >>> _______________________________________________ >>> GATE-users mailing list >>> GAT...@li... >>> https://lists.sourceforge.net/lists/listinfo/gate-users > |