Package: bpe-summarizer
BPE SummarizerThis 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.Installpip install bpe-summarizerUsagefrombpe_summarizerimportbpe_summarizebpe_summarize(article,percentile=99)ParametersParameterDefinitionDefaultTypedocumentA text blob with sentences delineated by punctuationNoneStringpercentileSentences that include tokens in the top kth percentile  will remain after summarization99FloattokenizerAhuggingfacePreTrainedTokenizerinstance that relies on byte-pair-encodingBartTokenizer.from_pretrained("facebook/bart-large")transformers.PreTrainedTokenizerapply_intra_sentenceIfTrue, summarization will be applied at both the document level and the sentence levelFalseFalseintra_sentence_percentileWhenapply_intra_sentenceisTrue, this percentile will be applied to individual sentences50*FloatNote:intra_sentence_percentileis ignored if its value represents less than the percentile score of the mean of tokens, otherwise the percentile score of the mean is used.ExamplesHuman SummaryBuilding Deep Dependency Structures Using A Wide-Coverage CCG ParserThis 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.\nBPE SummaryBuilding Deep Dependency Structures Using A Wide-Coverage CCG ParserThis 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.EvaluationTo evaluate the quality of the summarization, we apply asemantic similarity metric, to compare auto-summarized examples with human summaries from thescisummnet dataset. Text was represented usingsentence-level embeddings. Figure 1. charts the results from the BPE Summarizer as compared towidely usedsummarization techniques. It performed competitively and completed summarization in one one-hundredth of a second as compared to 55 seconds* over 100 samples.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 thesummarization component.References:Language Models are Unsupervised Multitask Learners, Radford, et.alHuggingface/GPT TokenizerGPT-2/EncoderComparing Transformers and Tokenizers, NémethHuggingface Bart Summarization Pipeline