class_docstr: Utility class for opening embeddings text files. Handles various compression formats,
  as well as context management.
  
  Parameters
  ----------
  file_uri: str
      It can be:
  
      * a file system path or a URL of an eventually compressed text file or a zip/tar archive
        containing a single file.
      * URI of the type ``(archive_path_or_url)#file_path_inside_archive`` if the text file
        is contained in a multi-file archive.
  
  encoding: str
  cache_dir: str
class_docstr_tok: ["Utility","class","for","opening","embeddings","text","files",".","Handles","various","compression","formats",",","as","well","as","context","management",".","Parameters","--","--","--","--","--","file_uri",":","str","It","can","be",":","*","a","file","system","path","or","a","URL","of","an","eventually","compressed","text","file","or","a","zip\/tar","archive","containing","a","single","file",".","*","URI","of","the","type","``","(","archive_path_or_url",")","#","file_path_inside_archive","``","if","the","text","file","is","contained","in","a","multi-file","archive",".","encoding",":","str","cache_dir",":","str"]
docstr: This function takes in input a string and if it contains 1 or 2 integers, it assumes the
  largest one it the number of tokens. Returns None if the line doesn't match that pattern. 
docstr_tok: ["This","function","takes","in","input","a","string","and","if","it","contains","1","or","2","integers",",","it","assumes","the","largest","one","it","the","number","of","tokens",".","Returns","None","if","the","line","does","n't","match","that","pattern","."]
code: def _get_num_tokens_from_first_line(line):
      """This function takes in input a string and if it contains 1 or 2 integers, it assumes the
      largest one it the number of tokens. Returns None if the line doesn't match that pattern.
      """
      fields = line.split(" ")
      if 1 <= len(fields) <= 2:
          try:
              int_fields = [int(x) for x in fields]
          except ValueError:
              return None
          else:
              num_tokens = max(int_fields)
              logger.info(
                  "Recognized a header line in the embedding file with number of tokens: %d",
                  num_tokens,
              )
              return num_tokens
      return None
  
imports: from __future__ import with_statement
  from __future__ import absolute_import
  import io
  import tarfile
  import zipfile
  import bz2
  import gzip
  import re
  import logging
  import warnings
  import itertools
  import numpy
  import torch
  from torch.nn.functional import embedding
  from allennlp.common import Params, Tqdm
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.file_utils import get_file_extension, cached_path
  from allennlp.data import Vocabulary
  from allennlp.modules.token_embedders.token_embedder import TokenEmbedder
  from allennlp.modules.time_distributed import TimeDistributed
label_desc: Use image node_id 13 for calling the EmbeddingsTextFile obj's underlying member method code with example usage: obj._get_num_tokens_from_first_line(line) and returns: None, num_tokens, None