original_docstring: 
      Measure the similarity between two strings using a character ngrams similarity
      metric, in which strings are transformed into trigrams of alnum-only characters,
      vectorized and weighted by tf-idf, then compared by cosine similarity.
  
      Args:
          str1
          str2
  
      Returns:
          Similarity between ``str1`` and ``str2`` in the interval [0.0, 1.0],
          where larger values correspond to more similar strings
  
      Note:
          This method has been used in cross-lingual plagiarism detection and
          authorship attribution, and seems to work better on longer texts.
          At the very least, it is *slow* on shorter texts relative to the other
          similarity measures.
      
docstring: Measure the similarity between two strings using a character ngrams similarity
  metric, in which strings are transformed into trigrams of alnum-only characters,
  vectorized and weighted by tf-idf, then compared by cosine similarity.
  
  str1
  str2
  
  
  
  This method has been used in cross-lingual plagiarism detection and
  authorship attribution, and seems to work better on longer texts.
  At the very least, it is *slow* on shorter texts relative to the other
  similarity measures.
docstring_tokens: Measure the similarity between two strings using a character ngrams similarity metric in which strings are transformed into trigrams of alnum - only characters vectorized and weighted by tf - idf then compared by cosine similarity . str1 str2 This method has been used in cross - lingual plagiarism detection and authorship attribution and seems to work better on longer texts . At the very least it is * slow * on shorter texts relative to the other similarity measures .
code: def character_ngrams(str1: str, str2: str) -> float:
      """
      Measure the similarity between two strings using a character ngrams similarity
      metric, in which strings are transformed into trigrams of alnum-only characters,
      vectorized and weighted by tf-idf, then compared by cosine similarity.
  
      Args:
          str1
          str2
  
      Returns:
          Similarity between ``str1`` and ``str2`` in the interval [0.0, 1.0],
          where larger values correspond to more similar strings
  
      Note:
          This method has been used in cross-lingual plagiarism detection and
          authorship attribution, and seems to work better on longer texts.
          At the very least, it is *slow* on shorter texts relative to the other
          similarity measures.
      """
      vectorizer = sklearn.feature_extraction.text.TfidfVectorizer(
          preprocessor=lambda s: " ".join(RE_ALNUM.findall(s.lower())),
          analyzer="char",
          token_pattern="(?u)\\b\\w+\\b",
          ngram_range=(3, 3),
      )
      mat = vectorizer.fit_transform([str1, str2])
      return 1.0 - pairwise_distances(mat[0, :], mat[1, :], metric="cosine").item()
code_tokens: def character_ngrams ( str1 : str , str2 : str ) -> float : vectorizer = sklearn . feature_extraction . text . TfidfVectorizer ( preprocessor = lambda s : " " . join ( RE_ALNUM . findall ( s . lower ( ) ) ) , analyzer = "char" , token_pattern = "(?u)\\b\\w+\\b" , ngram_range = ( 3 , 3 ) , ) mat = vectorizer . fit_transform ( [ str1 , str2 ] ) return 1.0 - pairwise_distances ( mat [ 0 , : ] , mat [ 1 , : ] , metric = "cosine" ) . item ( )
short_docstring: Measure the similarity between two strings using a character ngrams similarity
  metric, in which strings are transformed into trigrams of alnum-only characters,
  vectorized and weighted by tf-idf, then compared by cosine similarity.
short_docstring_tokens: Measure the similarity between two strings using a character ngrams similarity metric in which strings are transformed into trigrams of alnum - only characters vectorized and weighted by tf - idf then compared by cosine similarity .
comment: """
      Measure the similarity between two strings using a character ngrams similarity
      metric, in which strings are transformed into trigrams of alnum-only characters,
      vectorized and weighted by tf-idf, then compared by cosine similarity.
  
      Args:
          str1
          str2
  
      Returns:
          Similarity between ``str1`` and ``str2`` in the interval [0.0, 1.0],
          where larger values correspond to more similar strings
  
      Note:
          This method has been used in cross-lingual plagiarism detection and
          authorship attribution, and seems to work better on longer texts.
          At the very least, it is *slow* on shorter texts relative to the other
          similarity measures.
      """