def decodeInventoryEntry_level1(document):
 count = Inventory(str(document))
 for token in document:
  if (token.pos_ == (u'NOUN' or u'NNS' or u'NN')):
   item = str(token)
   for child in token.children:
    if ((child.dep_ == u'compound') or (child.dep_ == u'ad')):
     item = (str(child) + str(item))
    elif (child.dep_ == u'nummod'):
     count.amount = str(child).strip()
     for numerical_child in child.children:
      count.amount = (str(numerical_child) + str(count.amount).strip())
    else:
     print ((('WARNING: unknown child: ' + str(child)) + ':') + str(child.dep_))
   count.item = item
   count.unit = item
 return count

def decodeInventoryEntry_level1 ( document ) : count = Inventory ( str ( document ) ) for token in document : if ( token . pos_ == ( u'NOUN' or u'NNS' or u'NN' ) ) : item = str ( token ) for child in token . children : if ( ( child . dep_ == u'compound' ) or ( child . dep_ == u'ad' ) ) : item = ( str ( child ) + str ( item ) ) elif ( child . dep_ == u'nummod' ) : count . amount = str ( child ) . strip ( ) for numerical_child in child . children : count . amount = ( str ( numerical_child ) + str ( count . amount ) . strip ( ) ) else : print ( ( ( 'WARNING: unknown child: ' + str ( child ) ) + ':' ) + str ( child . dep_ ) ) count . item = item count . unit = item return count
decodes a basic entry such as: 6 lobster cake or 6 cakes .