alpheios-project / morph-client

Morphology Client Library Interface
ISC License
0 stars 1 forks source link

output without stem or suffix crashes #30

Open balmas opened 5 years ago

balmas commented 5 years ago

if we have a parser response which includes an inflection without a stem or suffix, we crash trying to create an Inflection object. Should handle this more gracefully.

E.g. see hazm output for http://morph.alpheios.net/api/v1/analysis/word?word=%D9%87%D8%A7%D9%85&lang=per&engine=hazm


<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <oac:Annotation xmlns:oac="http://www.openannotation.org/ns/" rdf:about="urn:TuftsMorphologyService:هام:hazm">
    <dcterms:creator xmlns:dcterms="http://purl.org/dc/terms/">
      <foaf:Agent xmlns:foaf="http://xmlns.com/foaf/0.1/" rdf:about="org.PersDigUMD:tools.hazm.v2"/>
    </dcterms:creator>
    <dcterms:created xmlns:dcterms="http://purl.org/dc/terms/">2018-10-24T20:15:34.057027</dcterms:created>
    <dc:rights xmlns:dc="http://purl.org/dc/elements/1.1/">Morphology from the HAZM Analyzer (http://www.sobhe.ir/hazm), supplied by the Center for Advanced Study of Language (CASL) at the University of Maryland, College Park (UMD) and adapted by the Roshan Institute for Persian Studies at UMD (http://persdig.umd.edu). This work was also supported by the Perseus Digital Library at Tufts University (http://www.perseus.tufts.edu).</dc:rights>
    <oac:hasTarget>
      <rdf:Description rdf:about="urn:word:هام"/>
    </oac:hasTarget>
    <dc:title xmlns:dc="http://purl.org/dc/elements/1.1/"/>
    <oac:hasBody rdf:resource="urn:uuid:idm140190922498120"/>
    <oac:Body rdf:about="urn:uuid:idm140190922498120">
      <rdf:type rdf:resource="cnt:ContentAsXML"/>
      <cnt:rest xmlns:cnt="http://www.w3.org/2008/content#">
        <entry>
          <dict>
            <hdwd xml:lang="per">هام</hdwd>
          </dict>
          <infl>
            <term xml:lang="per">
              <stem/>
            </term>
          </infl>
        </entry>
      </cnt:rest>
    </oac:Body>
  </oac:Annotation>
</rdf:RDF>