title: How to extract vocabulary from Pipeline
body: <p>I can extract vocabulary from CountVecotizerModel by the following way</p>
  
  <pre><code>fl = StopWordsRemover(inputCol="words", outputCol="filtered")
  df = fl.transform(df)
  cv = CountVectorizer(inputCol="filtered", outputCol="rawFeatures")
  model = cv.fit(df)
  
  print(model.vocabulary)
  </code></pre>
  
  <p>the above code will print list of vocabulary with index as it's ids.</p>
  
  <p>Now I have created a pipeline of the above code as following:</p>
  
  <pre><code>rm_stop_words = StopWordsRemover(inputCol="words", outputCol="filtered")
  count_freq = CountVectorizer(inputCol=rm_stop_words.getOutputCol(), outputCol="rawFeatures")
  
  pipeline = Pipeline(stages=[rm_stop_words, count_freq])
  model = pipeline.fit(dfm)
  df = model.transform(dfm)
  
  print(model.vocabulary) # This won't work as it's not CountVectorizerModel
  </code></pre>
  
  <p>it will throw the following error</p>
  
  <blockquote>
  <pre><code>print(len(model.vocabulary))
  </code></pre>
    
    <p>AttributeError: 'PipelineModel' object has no attribute 'vocabulary'</p>
  </blockquote>
  
  <p>So how to extract the Model attribute from the pipeline? </p>