text stringlengths 81 112k |
|---|
Adds a sub-command parser to `subparsers` to make a lifetime report.
def generate_lifetime_subparser(subparsers):
"""Adds a sub-command parser to `subparsers` to make a lifetime report."""
parser = subparsers.add_parser(
'lifetime', description=constants.LIFETIME_DESCRIPTION,
epilog=constants.L... |
Adds n-grams data to the data store.
def generate_ngrams(args, parser):
"""Adds n-grams data to the data store."""
store = utils.get_data_store(args)
corpus = utils.get_corpus(args)
if args.catalogue:
catalogue = utils.get_catalogue(args)
else:
catalogue = None
store.add_ngrams(... |
Adds a sub-command parser to `subparsers` to add n-grams data
to the data store.
def generate_ngrams_subparser(subparsers):
"""Adds a sub-command parser to `subparsers` to add n-grams data
to the data store."""
parser = subparsers.add_parser(
'ngrams', description=constants.NGRAMS_DESCRIPTION,
... |
Adds a sub-command parser to `subparsers` to prepare source XML
files for stripping.
def generate_prepare_subparser(subparsers):
"""Adds a sub-command parser to `subparsers` to prepare source XML
files for stripping."""
parser = subparsers.add_parser(
'prepare', description=constants.PREPARE_DE... |
Adds a sub-command parser to `subparsers` to manipulate CSV
results data.
def generate_results_subparser(subparsers):
"""Adds a sub-command parser to `subparsers` to manipulate CSV
results data."""
parser = subparsers.add_parser(
'results', description=constants.RESULTS_DESCRIPTION,
epi... |
Adds a sub-command parser to `subparsers` to generate search
results for a set of n-grams.
def generate_search_subparser(subparsers):
"""Adds a sub-command parser to `subparsers` to generate search
results for a set of n-grams."""
parser = subparsers.add_parser(
'search', description=constants.... |
Adds a sub-command parser to `subparsers` to generate statistics
from a set of results.
def generate_statistics_subparser(subparsers):
"""Adds a sub-command parser to `subparsers` to generate statistics
from a set of results."""
parser = subparsers.add_parser(
'stats', description=constants.STA... |
Adds a sub-command parser to `subparsers` to process prepared files
for use with the tacl ngrams command.
def generate_strip_subparser(subparsers):
"""Adds a sub-command parser to `subparsers` to process prepared files
for use with the tacl ngrams command."""
parser = subparsers.add_parser(
'st... |
Adds a sub-command parser to `subparsers` to run a diff query using
the supplied results sets.
def generate_supplied_diff_subparser(subparsers):
"""Adds a sub-command parser to `subparsers` to run a diff query using
the supplied results sets."""
parser = subparsers.add_parser(
'sdiff', descript... |
Adds a sub-command parser to `subparsers` to run an intersect query
using the supplied results sets.
def generate_supplied_intersect_subparser(subparsers):
"""Adds a sub-command parser to `subparsers` to run an intersect query
using the supplied results sets."""
parser = subparsers.add_parser(
... |
Outputs the result of highlighting a text.
def highlight_text(args, parser):
"""Outputs the result of highlighting a text."""
tokenizer = utils.get_tokenizer(args)
corpus = utils.get_corpus(args)
output_dir = os.path.abspath(args.output)
if os.path.exists(output_dir):
parser.exit(status=3, ... |
Generates a lifetime report.
def lifetime_report(args, parser):
"""Generates a lifetime report."""
catalogue = utils.get_catalogue(args)
tokenizer = utils.get_tokenizer(args)
results = tacl.Results(args.results, tokenizer)
output_dir = os.path.abspath(args.output)
os.makedirs(output_dir, exist_... |
Outputs the results of performing a counts query.
def ngram_counts(args, parser):
"""Outputs the results of performing a counts query."""
store = utils.get_data_store(args)
corpus = utils.get_corpus(args)
catalogue = utils.get_catalogue(args)
store.validate(corpus, catalogue)
store.counts(catal... |
Outputs the results of performing a diff query.
def ngram_diff(args, parser):
"""Outputs the results of performing a diff query."""
store = utils.get_data_store(args)
corpus = utils.get_corpus(args)
catalogue = utils.get_catalogue(args)
tokenizer = utils.get_tokenizer(args)
store.validate(corpu... |
Outputs the results of performing an intersection query.
def ngram_intersection(args, parser):
"""Outputs the results of performing an intersection query."""
store = utils.get_data_store(args)
corpus = utils.get_corpus(args)
catalogue = utils.get_catalogue(args)
store.validate(corpus, catalogue)
... |
Prepares XML files for stripping.
This process creates a single, normalised TEI XML file for each
work.
def prepare_xml(args, parser):
"""Prepares XML files for stripping.
This process creates a single, normalised TEI XML file for each
work.
"""
if args.source == constants.TEI_SOURCE_CBE... |
Searches texts for presence of n-grams.
def search_texts(args, parser):
"""Searches texts for presence of n-grams."""
store = utils.get_data_store(args)
corpus = utils.get_corpus(args)
catalogue = utils.get_catalogue(args)
store.validate(corpus, catalogue)
ngrams = []
for ngram_file in args... |
Processes prepared XML files for use with the tacl ngrams
command.
def strip_files(args, parser):
"""Processes prepared XML files for use with the tacl ngrams
command."""
stripper = tacl.Stripper(args.input, args.output)
stripper.strip_files() |
Pull out the application metadata for each flow in the input_stream
def http_meta_data(self):
"""Pull out the application metadata for each flow in the input_stream"""
# For each flow process the contents
for flow in self.input_stream:
# Client to Server
if flow['direc... |
Pull out the transport metadata for each packet in the input_stream
def transport_meta_data(self):
"""Pull out the transport metadata for each packet in the input_stream"""
# For each packet in the pcap process the contents
for item in self.input_stream:
# Get the transport data a... |
Method that turns bit flags into a human readable list
Args:
transport (dict): transport info, specifically needs a 'flags' key with bit_flags
Returns:
list: a list of human readable flags (e.g. ['syn_ack', 'fin', 'rst', ...]
def _readable_flags(transport):
... |
Generates and writes to a file in `output_dir` the data used to
display a stacked bar chart.
The generated data gives the percentages of the text of the
work (across all witnesses) that are in common with all other
works, shared with each "maybe" work, and unique.
:param data: ... |
Generates and writes to a file in `output_dir` the data used to
display a chord chart.
:param data: data to derive the chord data from
:type data: `pandas.DataFrame`
:param works: works to display
:type works: `list`
:param output_dir: directory to output data file to
... |
Generates and writes to a file in `output_dir` the data used to
display a matrix chart.
:param data: data to derive the matrix data from
:type data: `pandas.DataFrame`
:param works: works to display
:type works: `list`
:param output_dir: directory to output data file to
... |
Generates and writes to a file in `output_dir` the data used to
display a grouped bar chart.
This data gives, for each "maybe" work, the percentage of it
that is shared with `work`, and the percentage of `work` that
is shared with the "maybe" work.
:param data: data to derive t... |
Writes `results` to `fh` minus those results associated with the
'no' label.
:param results: results to be manipulated
:type results: file-like object
:param fh: output destination
:type fh: file-like object
def _drop_no_label_results(self, results, fh):
"""Writes `resu... |
Writes a statistics report for the results at `results_path` to
`out_path`.
Reuses an existing statistics report if one exists at
`out_path`.
:param out_path: path to output statistics report to
:type out_path: `str`
:param results_path: path of results to generate stat... |
Returns statistics on the difference between the intersection of
`yes_work` and `maybe_work` and the intersection of `yes_work`
and "no" works.
:param yes_work: name of work for which stats are collected
:type yes_work: `str`
:param maybe_work: name of work being compared with `... |
Returns statistics on the intersection between `yes_work` and
`maybe_work`.
:param yes_work: name of work for which stats are collected
:type yes_work: `str`
:param maybe_work: name of work being compared with `yes_work`
:type maybe_work: `str`
:param work_dir: directory... |
Returns statistics of how `yes_work` compares with `maybe_work`.
:param yes_work: name of work for which stats are collected
:type yes_work: `str`
:param maybe_work: name of work being compared with `yes_work`
:type maybe_work: `str`
:param work_dir: directory where generated fi... |
Collect and return the data of how each work in `maybe_works`
relates to each other work.
:param maybe_works:
:type maybe_works: `list` of `str`
:param no_works:
:type no_works: `list` of `str`
:param output_dir: base output directory
:type output_dir: `str`
... |
Returns statistics of how `yes_work` compares with the other works
in `no_catalogue` and the "maybe" works.
:param yes_work: name of work being processed
:type yes_work: `str`
:param no_catalogue: catalogue of containing `yes_work` and the "no"
works
... |
Runs `query` and outputs results to a file at `path`.
If `path` exists, the query is not run.
:param path: path to output results to
:type path: `str`
:param query: query to run
:type query: `method`
:param query_args: arguments to supply to the query
:type quer... |
Adds the database indices relating to n-grams.
def _add_indices(self):
"""Adds the database indices relating to n-grams."""
self._logger.info('Adding database indices')
self._conn.execute(constants.CREATE_INDEX_TEXTNGRAM_SQL)
self._logger.info('Indices added') |
Adds n-gram data from `corpus` to the data store.
:param corpus: corpus of works
:type corpus: `Corpus`
:param minimum: minimum n-gram size
:type minimum: `int`
:param maximum: maximum n-gram size
:type maximum: `int`
:param catalogue: optional catalogue to limit... |
Adds `ngrams` to a temporary table.
def _add_temporary_ngrams(self, ngrams):
"""Adds `ngrams` to a temporary table."""
# Remove duplicate n-grams, empty n-grams, and non-string n-grams.
ngrams = [ngram for ngram in ngrams if ngram and
isinstance(ngram, str)]
# Deduplic... |
Adds `results` to a temporary table with `label`.
:param results: results file
:type results: `File`
:param label: label to be associated with results
:type label: `str`
def _add_temporary_results(self, results, label):
"""Adds `results` to a temporary table with `label`.
... |
Adds n-gram data from `witness` to the data store.
:param witness: witness to get n-grams from
:type witness: `WitnessText`
:param minimum: minimum n-gram size
:type minimum: `int`
:param maximum: maximum n-gram size
:type maximum: `int`
def _add_text_ngrams(self, witne... |
Adds a Text record for `witness`.
:param witness: witness to add a record for
:type text: `WitnessText`
def _add_text_record(self, witness):
"""Adds a Text record for `witness`.
:param witness: witness to add a record for
:type text: `WitnessText`
"""
filename... |
Adds `ngrams`, that are of size `size`, to the data store.
The added `ngrams` are associated with `text_id`.
:param text_id: database ID of text associated with `ngrams`
:type text_id: `int`
:param size: size of n-grams
:type size: `int`
:param ngrams: n-grams to be add... |
Analyses the database, or `table` if it is supplied.
:param table: optional name of table to analyse
:type table: `str`
def _analyse(self, table=''):
"""Analyses the database, or `table` if it is supplied.
:param table: optional name of table to analyse
:type table: `str`
... |
Returns `row`, possibly with its count changed to 0, depending on
the status of the n-grams that compose it.
The n-gram represented in `row` can be decomposed into two
(n-1)-grams. If neither sub-n-gram is present in `matches`, do
not change the count since this is a new difference.
... |
Returns `output_fh` populated with CSV results giving
n-gram counts of the witnesses of the works in `catalogue`.
:param catalogue: catalogue matching filenames to labels
:type catalogue: `Catalogue`
:param output_fh: object to output results to
:type output_fh: file-like object... |
Writes the rows of `cursor` in CSV format to `output_fh`
and returns it.
:param cursor: database cursor containing data to be output
:type cursor: `sqlite3.Cursor`
:param fieldnames: row headings
:type fieldnames: `list`
:param output_fh: file to write data to
:t... |
Writes the rows of `cursor` in CSV format to a temporary file and
returns the path to that file.
:param cursor: database cursor containing data to be output
:type cursor: `sqlite3.Cursor`
:param fieldnames: row headings
:type fieldnames: `list`
:rtype: `str`
def _csv_te... |
Deletes all n-grams associated with `text_id` from the data
store.
:param text_id: database ID of text
:type text_id: `int`
def _delete_text_ngrams(self, text_id):
"""Deletes all n-grams associated with `text_id` from the data
store.
:param text_id: database ID of text... |
Returns output_fh with diff results that have been reduced.
Uses a temporary file to store the results from `cursor`
before being reduced, in order to not have the results stored
in memory twice.
:param cursor: database cursor containing raw diff data
:type cursor: `sqlite3.Cur... |
Returns `output_fh` populated with CSV results giving the n-grams
that are unique to the witnesses of each labelled set of works
in `catalogue`.
Note that this is not the same as the symmetric difference of
these sets, except in the case where there are only two
labels.
... |
Returns `output_fh` populated with CSV results giving the
difference in n-grams between the witnesses of labelled sets
of works in `catalogue`, limited to those works labelled with
`prime_label`.
:param catalogue: catalogue matching filenames to labels
:type catalogue: `Catalogu... |
Returns `output_fh` populated with CSV results giving the n-grams
that are unique to the witnesses in each set of works in
`results_sets`, using the labels in `labels`.
Note that this is not the same as the symmetric difference of
these sets, except in the case where there are only two
... |
Drops the database indices relating to n-grams.
def _drop_indices(self):
"""Drops the database indices relating to n-grams."""
self._logger.info('Dropping database indices')
self._conn.execute(constants.DROP_TEXTNGRAM_INDEX_SQL)
self._logger.info('Finished dropping database indices') |
Returns the database ID of the Text record for `witness`.
This may require creating such a record.
If `text`\'s checksum does not match an existing record's
checksum, the record's checksum is updated and all associated
TextNGram and TextHasNGram records are deleted.
:param wit... |
Returns True if a text has existing records for n-grams of
size `size`.
:param text_id: database ID of text to check
:type text_id: `int`
:param size: size of n-grams
:type size: `int`
:rtype: `bool`
def _has_ngrams(self, text_id, size):
"""Returns True if a tex... |
Creates the database schema.
This will not create tables or indices that already exist and
is safe to be called on an existing database.
def _initialise_database(self):
"""Creates the database schema.
This will not create tables or indices that already exist and
is safe to be ... |
Returns `output_fh` populated with CSV results giving the
intersection in n-grams of the witnesses of labelled sets of
works in `catalogue`.
:param catalogue: catalogue matching filenames to labels
:type catalogue: `Catalogue`
:param output_fh: object to output results to
... |
Returns `output_fh` populated with CSV results giving the n-grams
that are common to witnesses in every set of works in
`results_sets`, using the labels in `labels`.
:param results_filenames: list of results to be diffed
:type results_filenames: `list` of `str`
:param labels: la... |
Returns `output_fh` populated with a reduced set of data from
`matches_fh`.
Diff results typically contain a lot of filler results that
serve only to hide real differences. If one text has a single
extra token than another, the diff between them will have
results for every n-gra... |
Returns `output_fh` populated with CSV results for each n-gram in
`ngrams` that occurs within labelled witnesses in `catalogue`.
If `ngrams` is empty, include all n-grams.
:param catalogue: catalogue matching filenames to labels
:type catalogue: `Catalogue`
:param ngrams: n-gra... |
Returns a dictionary of the unique labels in `catalogue` and the
count of all tokens associated with each, and sets the record
of each Text to its corresponding label.
Texts that do not have a label specified are set to the empty
string.
Token counts are included in the results... |
Returns the labels in `label_data` sorted in descending order
according to the 'size' (total token count) of their referent
corpora.
:param label_data: labels (with their token counts) to sort
:type: `dict`
:rtype: `list`
def _sort_labels(label_data):
"""Returns the lab... |
Updates the record with `text_id` with `witness`\'s checksum and
token count.
:param withness: witness to update from
:type witness: `WitnessText`
:param text_id: database ID of Text record
:type text_id: `int`
def _update_text_record(self, witness, text_id):
"""Updates... |
Returns True if all of the files labelled in `catalogue`
are up-to-date in the database.
:param corpus: corpus of works
:type corpus: `Corpus`
:param catalogue: catalogue matching filenames to labels
:type catalogue: `Catalogue`
:rtype: `bool`
def validate(self, corpus,... |
Returns `a1` marked up with HTML spans around characters that are
also at the same index in `a2`.
:param a1: text sequence from one witness
:type a1: `str`
:param a2: text sequence from another witness
:type a2: `str`
:rtype: `str`
def _format_alignment(self, a1, a2):
... |
Returns a tuple of HTML fragments rendering each element of the
sequence.
def render(self):
"""Returns a tuple of HTML fragments rendering each element of the
sequence."""
f1 = self._format_alignment(self._alignment[0], self._alignment[1])
f2 = self._format_alignment(self._align... |
Generates sequence reports and writes them to the output directory.
:param output_dir: directory to output reports to
:type output_dir: `str`
:param minimum_size: minimum size of n-grams to create sequences for
:type minimum_size: `int`
def generate(self, output_dir, minimum_size):
... |
Returns an aligned sequence (or None) between extract `t1_span` of
witness text `t1` and extract `t2_span` of witness text `t2`.
Adds the span of the aligned sequence, if any, to
`covered_spans` (which, being mutable, is modified in place
without needing to be returned).
This m... |
Generates aligned sequences between each witness labelled
`primary_label` and each witness labelled `secondary_label`,
based around `ngrams`.
:param primary_label: label for one side of the pairs of
witnesses to align
:type primary_label: `str`
:par... |
Generates aligned sequences for the texts `t1` and `t2`, based
around `ngram`.
Does not generate sequences that occur within `covered_spans`.
:param t1: text content of first witness
:type t1: `str`
:param t2: text content of second witness
:type t2: `str`
:para... |
Generates and outputs aligned sequences for the texts `t1` and `t2`
from `ngrams`.
:param l1: label of first witness
:type l1: `str`
:param t1: text content of first witness
:type t1: `str`
:param l2: label of second witness
:type l2: `str`
:param t2: tex... |
Returns the text content of `text`, with all multi-character tokens
replaced with a single character. Substitutions are recorded
in self._substitutes.
:param text: text to get content from
:type text: `Text`
:rtype: `str`
def _get_text(self, text):
"""Returns the text c... |
Returns the subset of `text` encompassed by `span`, plus
`context_length` characters before and after.
:param text: text to extract the sequence from
:type text: `str`
:param span: start and end indices within `text`
:type span: 2-`tuple` of `int`
:param context_length: ... |
Returns True if both `span1` and `span2` fall within
`covered_spans`.
:param span1: start and end indices of a span
:type span1: 2-`tuple` of `int`
:param span2: start and end indices of a span
:type span2: 2-`tuple` of `int`
:param covered_spans: lists of start and end ... |
Returns True if `span` falls within `covered_spans`.
:param span: start and end indices of a span
:type span: 2-`tuple` of `int`
:param covered_spans: list of start and end indices for parts
of the text already covered by a sequence
:type covered_spans: `li... |
Adds common arguments for commands making use of a corpus to
`parser`.
def add_corpus_arguments(parser):
"""Adds common arguments for commands making use of a corpus to
`parser`."""
add_tokenizer_argument(parser)
parser.add_argument('corpus', help=constants.DB_CORPUS_HELP,
m... |
Adds common arguments for the database sub-commands to
`parser`.
`db_option` provides a means to work around
https://bugs.python.org/issue9338 whereby a positional argument
that follows an optional argument with nargs='+' will not be
recognised. When `db_optional` is True, create the database
a... |
Adds common arguments for supplied query sub-commands to
`parser`.
def add_supplied_query_arguments(parser):
"""Adds common arguments for supplied query sub-commands to
`parser`."""
parser.add_argument('-l', '--labels', help=constants.SUPPLIED_LABELS_HELP,
nargs='+', required=Tr... |
Configures the logging used.
def configure_logging(verbose, logger):
"""Configures the logging used."""
if not verbose:
log_level = logging.WARNING
elif verbose == 1:
log_level = logging.INFO
else:
log_level = logging.DEBUG
logger.setLevel(log_level)
ch = colorlog.Stream... |
Returns a `tacl.Catalogue`.
def get_catalogue(args):
"""Returns a `tacl.Catalogue`."""
catalogue = tacl.Catalogue()
catalogue.load(args.catalogue)
return catalogue |
Returns a `tacl.Corpus`.
def get_corpus(args):
"""Returns a `tacl.Corpus`."""
tokenizer = get_tokenizer(args)
return tacl.Corpus(args.corpus, tokenizer) |
Returns a `tacl.DataStore`.
def get_data_store(args):
"""Returns a `tacl.DataStore`."""
return tacl.DataStore(args.db, args.memory, args.ram) |
Returns a list of n-grams read from the file at `path`.
def get_ngrams(path):
"""Returns a list of n-grams read from the file at `path`."""
with open(path, encoding='utf-8') as fh:
ngrams = [ngram.strip() for ngram in fh.readlines()]
return ngrams |
Returns the token content of this text with every occurrence of
each n-gram in `ngrams` replaced with `replacement`.
The replacing is performed on each n-gram by descending order
of length.
:param ngrams: n-grams to be replaced
:type ngrams: `list` of `str`
:param repla... |
Returns a generator supplying the n-grams (`minimum` <= n
<= `maximum`) for this text.
Each iteration of the generator supplies a tuple consisting of
the size of the n-grams and a `collections.Counter` of the
n-grams.
:param minimum: minimum n-gram size
:type minimum: `... |
Returns the n-grams generated from `sequence`.
Based on the ngrams function from the Natural Language
Toolkit.
Each n-gram in the returned list is a string with whitespace
removed.
:param sequence: the source data to be converted into n-grams
:type sequence: sequence
... |
Returns a compiled regular expression matching on any of the
n-grams in `filter_ngrams`.
:param filter_ngrams: n-grams to use in regular expression
:type filter_ngrams: `list` of `str`
:rtype: `_sre.SRE_Pattern`
def get_filter_ngrams_pattern(filter_ngrams):
"""Returns a compile... |
Returns a generator supplying the n-grams (`minimum` <= n
<= `maximum`) for this text.
Each iteration of the generator supplies a tuple consisting of
the size of the n-grams and a `collections.Counter` of the
n-grams.
:param minimum: minimum n-gram size
:type minimum: `... |
Set a many-to-many field on an object
def set_relation_many_to_many(self, obj, field_name, objs):
"Set a many-to-many field on an object"
relation = getattr(obj, field_name)
if hasattr(relation, 'set'):
relation.set(objs) # Django 2.x
else:
setattr(obj, field_nam... |
Parse error messages and collect the missing-relationship errors
as a dict of Resource -> {id set}
def detect_missing_relations(self, obj, exc):
"""
Parse error messages and collect the missing-relationship errors
as a dict of Resource -> {id set}
"""
missing = defaultdi... |
Parse error, and if it describes any violations of a uniqueness constraint,
return the corresponding fields, else None
def detect_uniqueness_error(self, exc):
"""
Parse error, and if it describes any violations of a uniqueness constraint,
return the corresponding fields, else None
... |
Pull out the TLS metadata for each flow in the input_stream
def tls_meta_data(self):
"""Pull out the TLS metadata for each flow in the input_stream"""
# For each flow process the contents
for flow in self.input_stream:
# Just TCP for now
if flow['protocol'] != 'TCP':
... |
This method creates a dictionary out of a non-builtin object
def make_dict(obj):
"""This method creates a dictionary out of a non-builtin object"""
# Recursion base case
if is_builtin(obj) or isinstance(obj, OrderedDict):
return obj
output_dict = {}
for key in dir(obj):
if not key... |
Follow the dot notation to get the proper field, then perform the action
Args:
data: the data as a dictionary (required to be a dictionary)
key: the key (as dot notation) into the data that gives the field (IP.src)
Returns:
the value of the field(subfield) if it exist, ... |
Writes the report data to `fh` in CSV format and returns it.
:param fh: file to write data to
:type fh: file object
:rtype: file object
def csv(self, fh):
"""Writes the report data to `fh` in CSV format and returns it.
:param fh: file to write data to
:type fh: file ob... |
Replaces result rows with summary statistics about the results.
These statistics give the filename, total matching tokens,
percentage of matching tokens and label for each witness in
the results.
def generate_statistics(self):
"""Replaces result rows with summary statistics about the r... |
Return a single string consisting of the parts specified in
`slices` joined together by the tokenizer's joining string.
:param full_text: the text to be sliced
:type full_text: `str`
:param slices: list of slice indices to apply to `full_text`
:type slices: `list` of `list`\s
... |
Return a list of slice indices lists derived from `match_slices`
with no overlaps.
def _merge_slices(match_slices):
"""Return a list of slice indices lists derived from `match_slices`
with no overlaps."""
# Sort by earliest range, then by largest range.
match_slices.sort(key=lam... |
Return the counts of total tokens and matching tokens in `witness`.
:param witness: witness text
:type witness: `tacl.WitnessText`
:param matches: n-gram matches
:type matches: `pandas.DataFrame`
:rtype: `tuple` of `int`
def _process_witness(self, witness, matches):
"""... |
Returns a list of all witnesses of variant readings in
`source_tree` along with their XML ids.
:param source_tree: XML tree of source document
:type source_tree: `etree._ElementTree`
:rtype: `list` of `tuple`
def get_witnesses(self, source_tree):
"""Returns a list of all witnes... |
Run the Simple Packet Printer Example
def run(iface_name=None, bpf=None, summary=None, max_packets=50):
"""Run the Simple Packet Printer Example"""
# Create the classes
streamer = packet_streamer.PacketStreamer(iface_name=iface_name, bpf=bpf, max_packets=max_packets)
meta = packet_meta.PacketMeta()
... |
Generates the report, writing it to `output_dir`.
def generate(self, output_dir, catalogue, results, label):
"""Generates the report, writing it to `output_dir`."""
data = results.get_raw_data()
labels = catalogue.ordered_labels
ngrams = self._generate_results(output_dir, labels, data)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.