
import argparse

import pyconll

parser = argparse.ArgumentParser()
parser.add_argument('filename', help='The name of the file to transform')
args = parser.parse_args()

corpus = pyconll.load_from_file(args.filename)
for sentence in corpus:
    for token in sentence:
        if token.lemma == 'dog' and token.upos == 'VERB':
            token.misc['Polysemous'] = True

# Print to standard out which can then be redirected.
print(corpus.conll())


import argparse

import pyconll

parser = argparse.ArgumentParser()
parser.add_argument('filename', help='The name of the file to transform')
args = parser.parse_args()

corpus = pyconll.load_from_file(args.filename)
for sentence in corpus:
    for token in sentence:
        if token.lemma == 'dog' and token.upos == 'VERB':
            # Note: This means that 'Polysemous' will be present as a singleton
            # in the token line. To remove 'Polysemous' from the token's
            # features, call del token.misc['Polysemous']
            token.misc['Polysemous'] = None

# Print to standard out which can then be redirected.
print(corpus.conll())

Update example with correct form, and with comment.
Update example with correct form, and with comment.

  
  import argparse
  
  import pyconll
  
  parser = argparse.ArgumentParser()
  parser.add_argument('filename', help='The name of the file to transform')
  args = parser.parse_args()
  
  corpus = pyconll.load_from_file(args.filename)
  for sentence in corpus:
      for token in sentence:
          if token.lemma == 'dog' and token.upos == 'VERB':
+             # Note: This means that 'Polysemous' will be present as a singleton
+             # in the token line. To remove 'Polysemous' from the token's
+             # features, call del token.misc['Polysemous']
-             token.misc['Polysemous'] = True
+             token.misc['Polysemous'] = None
  
  # Print to standard out which can then be redirected.
  print(corpus.conll())
  
Update example with correct form, and with comment.
## Code Before:

import argparse

import pyconll

parser = argparse.ArgumentParser()
parser.add_argument('filename', help='The name of the file to transform')
args = parser.parse_args()

corpus = pyconll.load_from_file(args.filename)
for sentence in corpus:
    for token in sentence:
        if token.lemma == 'dog' and token.upos == 'VERB':
            token.misc['Polysemous'] = True

# Print to standard out which can then be redirected.
print(corpus.conll())

## Instruction:
Update example with correct form, and with comment.
## Code After:

import argparse

import pyconll

parser = argparse.ArgumentParser()
parser.add_argument('filename', help='The name of the file to transform')
args = parser.parse_args()

corpus = pyconll.load_from_file(args.filename)
for sentence in corpus:
    for token in sentence:
        if token.lemma == 'dog' and token.upos == 'VERB':
            # Note: This means that 'Polysemous' will be present as a singleton
            # in the token line. To remove 'Polysemous' from the token's
            # features, call del token.misc['Polysemous']
            token.misc['Polysemous'] = None

# Print to standard out which can then be redirected.
print(corpus.conll())
