(self, f)
Load from a file object.

    Args:
      f: File object to load vocabulary from
Load from a file object.
Load from a file object .
def _load_from_file_object(self, f):
    """Load from a file object.

    Args:
      f: File object to load vocabulary from
    """
    subtoken_strings = []
    for line in f:
      s = line.rstrip()
      # Some vocab files wrap words in single quotes, but others don't
      if ((s.startswith("'") and s.endswith("'")) or
          (s.startswith("\"") and s.endswith("\""))):
        s = s[1:-1]
      subtoken_strings.append(native_to_unicode(s))
    self._init_subtokens_from_list(subtoken_strings)
    self._init_alphabet_from_tokens(subtoken_strings)
def _load_from_file_object ( self , f ) : subtoken_strings = [ ] for line in f : s = line . rstrip ( ) # Some vocab files wrap words in single quotes, but others don't if ( ( s . startswith ( "'" ) and s . endswith ( "'" ) ) or ( s . startswith ( "\"" ) and s . endswith ( "\"" ) ) ) : s = s [ 1 : - 1 ] subtoken_strings . append ( native_to_unicode ( s ) ) self . _init_subtokens_from_list ( subtoken_strings ) self . _init_alphabet_from_tokens ( subtoken_strings )