Reference¶
mc_scraper¶
-
main
(tags, n_posts[, plugins=('wp'), target="new_project"])¶ Retrieve blog posts and yield them as pure ASCII.
Parameters: - tags (list of str) – Keywords to look for
- n_posts (int) – Number of posts to retrieve per keyword and plugin
- (list of str) (plugins) – Plugins to include. Plugins must be saved in the ‘plugins’ folder under <plugin_name>.py
- target (str) – Project name
Return type: list of str
mc_indexer¶
-
build_index
(sourcefile)¶ Build index based on sourcefile and return first node.
Parameters: sourcefile (str) – Path and file name of the MeSH database (e.g. desc2016.xml) Return type: mc_tree.Node
-
traverse
(index, posts)¶ Find indexed words from posts and return the preferred term and its tree number
Parameters: - index (mc_tree.Node) – The tree node from where to start the search
- posts (list of str) – List of all the posts in pure ASCII
Return type: list of tuples of str
mc_grapher¶
-
main
(project[, categories=[], minweight=1, highlight=False, exclude=[], color_scheme="default", source="terms.txt"]) Build and show the graph.
Parameters: - project (str) – The project name
- categories (list of str) – The MeSH categories to include. If the list is empty, all categories will be included.
- minweight (int) – Minimum weight necessary for connections to be displayed.
- highlight (str) – A specific term to highlight. If false, no term will be highlighted
- exclude (list of str) – List of terms to exclude from the analysis.
- color_scheme (str) – Color scheme for the plot, not implemented
- source (src) – Name of sourcefile within project folder
Return type: None
-
build_matrix
(res_file[, categories=[], highlight=False, exclude=[], color_scheme="default"])¶ Build and return the correlation matrix and node labels and their colors
param res_file: File name and path to load type res_file: str param categories: List of categories to include type categories: list of str param highlight: MeSH term to highlight type highlight: str param exclude: List of MeSH terms to exclude type exclude: list of str param color_scheme: Color scheme for the plot, not implemented type color_scheme: str rtype: scipy.sparse.dok_matrix, list of str, list of str
-
create_plot
(corr_map, terms, colors[, minweight=1, dpi=600])¶ Draw plot and create metadata.
Parameters: - corr_map (scipy.sparse.dok_matrix) – Correlation matrix as returned from build_matrix()
- terms (list of str) – List of unique terms in the same order as the corrmap axes
- colors (list of str) – List of colors according to MeSH category in the same order as the corrmap axes
- minweight (int) – Minimum number of co-occurrences to draw.
- dpi (int) – DPI for plot
Return type: Matplotlib.Figure, list of str, list of str