class_docstr: A user facing class for text classification
class_docstr_tok: ["A","user","facing","class","for","text","classification"]
docstr: Predict [MASK] tokens in a string.
  targets limit possible guesses if supplied.
  top_k describes number of targets to return*
  *top_k does not apply if targets is supplied
docstr_tok: ["Predict","[","MASK","]","tokens","in","a","string",".","targets","limit","possible","guesses","if","supplied",".","top_k","describes","number","of","targets","to","return","*","*","top_k","does","not","apply","if","targets","is","supplied"]
code: def predict_mask(
      self,
      text: str,
      targets: Optional[List[str]] = None,
      top_k: int = 1,
  ) -> List[WordPredictionResult]:
      """
      Predict [MASK] tokens in a string.
      targets limit possible guesses if supplied.
      top_k describes number of targets to return*
      *top_k does not apply if targets is supplied
      """
  
      # loads pipeline if it hasn't been loaded already.
      self._load_pipeline()
  
      if not isinstance(text, str):
          raise ValueError(
              'the "text" argument must be a single string'
          )
  
      text_for_pipeline = self.adaptor.preprocess_mask_text(text)
      answers = self._pipeline(
          text_for_pipeline, targets=targets, top_k=top_k
      )
  
      fix_token = self.adaptor.postprocess_mask_prediction_token
      return [
          WordPredictionResult(
              token=fix_token(answer["token_str"]),
              score=answer["score"],
          )
          for answer in answers
      ]
  
file_path: happy-transformer/happytransformer/happy_word_prediction.py
imports: from dataclasses import dataclass
  from datasets import Dataset
  from typing import List, Optional, Union
  from transformers import AutoModelForMaskedLM, DataCollatorForLanguageModeling, FillMaskPipeline
  from happytransformer.adaptors import get_adaptor
  from happytransformer.args import WPEvalArgs, WPTrainArgs
  from happytransformer.fine_tuning_util import EvalResult, tok_text_gen_mlm, csv_tok_text_gen_mlm
  from happytransformer.happy_transformer import HappyTransformer
label_desc: Use image node_id 2 for calling the HappyWordPrediction obj's underlying member method code with example usage: obj.predict_mask(text, targets, top_k) and returns: unknown