mindmeld.markup module¶
The markup module contains functions for interacting with the MindMeld Markup language for representing annotations of query text inline.
-
mindmeld.markup.
bootstrap_query_file
(input_file, output_file, nlp, **kwargs)[source]¶ Apply predicted annotations to a file of text queries
Parameters:
-
mindmeld.markup.
bootstrap_query_row
(proc_query, show_confidence, **kwargs)[source]¶ Produce predicted annotation values and confidences for a single query
Parameters: - proc_query (ProcessedQuery) -- a labeled query
- show_confidence (bool) -- whether to generate confidence columns
- **kwargs -- flags indicating which columns to generate
Returns: (dict)
-
mindmeld.markup.
cache_query_file
(file_path, query_cache, query_factory=None, app_path=None, domain=None, intent=None, is_gold=False)[source]¶ Loads the specified query file into the query cache
Parameters: - file_path (str) -- The path of the file to load
- query_cache (QueryCache) -- A container containing cache query objects
- query_factory (QueryFactory, optional) -- An object which can create queries.
- app_path (str) -- The app path
- domain (str, optional) -- The name of the domain annotated for the query.
- intent (str, optional) -- The name of the intent annotated for the query.
- is_gold (bool, optional) -- True if the markup passed in is a reference, human-labeled example. Defaults to False.
Returns: List of cached query ids
-
mindmeld.markup.
dump_queries
(queries, markup_format='mindmeld', **kwargs)[source]¶ Converts a collection of processed queries to marked up query text
Parameters: - queries (iterable) -- A collection of processed queries
- markup_format (str, optional) -- The format to use. Valid formats include 'mindmeld' and 'brat'. Defaults to 'mindmeld'
- **kwargs -- additional format specific parameters may be passed in as keyword arguments.
Yields: str or tuple -- A marked up representation of the query
-
mindmeld.markup.
dump_query
(processed_query, markup_format='mindmeld', **kwargs)[source]¶ Converts a processed query into marked up query text.
Parameters: - processed_query (ProcessedQuery) -- The query to convert
- markup_format (str, optional) -- The format to use. Valid formats include 'mindmeld' and 'brat'. Defaults to 'mindmeld'
- **kwargs -- additional format specific parameters may be passed in as keyword arguments.
Returns: A marked up representation of the query
Return type: Raises:
-
mindmeld.markup.
load_query
(markup, query_factory=None, app_path=None, domain=None, intent=None, is_gold=False, query_options=None)[source]¶ Creates a processed query object from marked up query text.
Parameters: - markup (str) -- The marked up query text.
- query_factory (QueryFactory, optional) -- An object which can create queries.
- app_path (str, optional) -- The dir path of the application
- domain (str, optional) -- The name of the domain annotated for the query.
- intent (str, optional) -- The name of the intent annotated for the query.
- is_gold (bool, optional) -- True if the markup passed in is a reference, human-labeled example. Defaults to False.
- query_options (dict, optional) -- A dict containing options for creating a Query, such as language, time_zone and timestamp
Returns: a processed query
Return type: ProcessedQuery
-
mindmeld.markup.
mark_down
(markup)[source]¶ Removes all entity mark up from a string
Parameters: markup (str) -- A marked up string Returns: A clean string with no mark up Return type: str
-
mindmeld.markup.
mark_down_file
(file_path)[source]¶ Read all annotated queries from the input file and remove all the annotations
Parameters: file_path (str) -- The path of the file to load Yields: (str) -- marked down query text for each line
-
mindmeld.markup.
process_markup
(markup, query_factory, query_options)[source]¶ - This function takes in some text and returns a constructed Query object associated with the
- text, along with other objects like a list of entities.
Parameters: Returns: Returns a tuple of the raw text, the Query object associated with the text and a list of entities (ProcessedQuery) associated with the text
Return type: