nimare.annotate.text
.generate_cooccurrence¶
-
generate_cooccurrence
(text_df, text_column='abstract', vocabulary=None, window=5)[source]¶ Build co-occurrence matrix from documents. Not the same approach as used by the GloVe model.
Parameters: - text_df ((D x 2)
pandas.DataFrame
) – A DataFrame with two columns (‘id’ and ‘text’). D = document. - vocabulary (
list
, optional) – List of words in vocabulary to extract from text. - window (
int
, optional) – Window size for cooccurrence. Words which appear within window words of one another co-occur.
Returns: df – One cooccurrence matrix per document in text_df.
Return type: (V, V, D)
pandas.Panel
- text_df ((D x 2)