Skip to main content

BPE Summarizer

CI

This summarizer attempts to leverage Byte Pair Encoding (BPE) tokenization and the Bart vocabulary to filter text by semantic meaningfulness.

BPE text representation is a subword level approach to tokenization which aims to efficiently reuse parts of words while retaining semantic value.

The algorithm is based on the frequency of n-gram pairs. More frequent pairs are represented by larger tokens.

This project explored the assumption that token size correlates strongly to semantic meaningfulness. This summarization approach intends to surface the most meaningful sentences with comparing token values and retaining sentences from the original text that included meaningful tokens within a specified percentile.

Install

pip install bpe-summarizer

Usage

from bpe_summarizer import bpe_summarize

bpe_summarize(article, percentile=99)

Parameters

Parameter Definition Default Type
document A text blob with sentences delineated by punctuation None String
percentile Sentences that include tokens in the top kth percentile will remain after summarization 99 Float
tokenizer A huggingface PreTrainedTokenizer instance that relies on byte-pair-encoding BartTokenizer.from_pretrained("facebook/bart-large") transformers.PreTrainedTokenizer
apply_intra_sentence If True, summarization will be applied at both the document level and the sentence level False False
intra_sentence_percentile When apply_intra_sentence is True, this percentile will be applied to individual sentences 50* Float
  • Note: intra_sentence_percentile is ignored if its value represents less than the percentile score of the mean of tokens, otherwise the percentile score of the mean is used.

Examples

Human Summary

Building Deep Dependency Structures Using A Wide-Coverage CCG Parser

This paper describes a wide-coverage statistical parser that uses Combinatory Categorial Grammar (CCG) to derive dependency structures.

The parser differs from most existing wide-coverage treebank parsers in capturing the long-range dependencies inherent in constructions such as coordination, extraction, raising and control, as well as the standard local predicate-argument dependencies.

A set of dependency structures used for training and testing the parser is obtained from a treebank of CCG normal-form derivations, which have been derived (semi-) automatically from the Penn Treebank.\nThe parser correctly recovers over 80% of labelled dependencies, and around 90% of unlabelled dependencies.

We provide examples showing how heads can fill dependency slots during a derivation, and how long-range dependencies can be recovered through unification of co-indexed head variables.

We define predicate argument structure for CCG in terms of the dependencies that hold between words with lexical functor categories and their arguments.\n

BPE Summary

Building Deep Dependency Structures Using A Wide-Coverage CCG Parser

This paper describes a wide-coverage statistical parser that uses Combinatory Categorial Grammar (CCG) to derive dependency structures.

The parser differs from most existing wide-coverage treebank parsers in capturing the long-range dependencies inherent in constructions such as coordination, extraction, raising and control, as well as the standard local predicate-argument dependencies.

A set of dependency structures used for training and testing the parser is obtained from a treebank of CCG normal-form derivations, which have been derived (semi-) automatically from the Penn Treebank. The parser correctly recovers over 80% of labelled dependencies, and around 90% of unlabelled dependencies. However, the dependencies are typically derived from a context-free phrase structure.

Evaluation

To evaluate the quality of the summarization, we apply a semantic similarity metric, to compare auto-summarized examples with human summaries from the scisummnet dataset. Text was represented using sentence-level embeddings. Figure 1. charts the results from the BPE Summarizer as compared to widely used summarization techniques. It performed competitively and completed summarization in one one-hundredth of a second as compared to 55 seconds* over 100 samples.

Side-by-side with widely used summarizer

Fig1. Evaluation alongside a widely used summarizer

*Performance evaluation was done using a CPU, and the competitive technique was applied after stripping down to use only the summarization component.

References:

Metadata

Release files for bpe-summarizer 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bpe-summarizer 0.2.1
File Size Uploaded
bpe-summarizer-0.2.1.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bpe-summarizer 0.2.1
File Interpreter ABI Platform
bpe_summarizer-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.5 kB

Release files / bpe-summarizer-0.2.1.tar.gz

Download URL bpe-summarizer-0.2.1.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bb3a2155efc82c2813c00f5048a44ae18c81dfd698d3d0df8d3b04d47be129fc
BLAKE2b-256 checksum
How to use checksums
9ffe9d565f1c1a5b437283f3ee38c1e2c74647594d79f21e5f78da67036f9532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / bpe_summarizer-0.2.1-py3-none-any.whl

Download URL bpe_summarizer-0.2.1-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07b56c246d482b45d2c3e8eddc1b71fe4f255311b3043c871eab869ad26e4e7e
BLAKE2b-256 checksum
How to use checksums
75697c92f24c89eb76064134d7ee8a8d7801be88ccfcf42547900bc7a1cf368c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page