Leveraging HTML in Free Text Web Named Entity Recognition (2020)

Abstract: HTML tags are typically discarded in free text Named Entity Recognition from Web pages. We investigate whether these discarded tags might be used to improve NER performance. We compare Text+Tags sentences with their Text-Only equivalents, over five datasets, two free text segmentation granularities and two NER models. We find an increased F1 performance for Text+Tags of between 0.9% and 13.2% over all datasets, variants and models. This performance increase, over datasets of varying entity types, HTML density and construction quality, indicates our method is flexible and adaptable. These findings imply that a similar technique might be of use in other Web-aware NLP tasks, including the enrichment of deep language models.

## introduction named entity recognition (ner) is the identification of the proper names of objects. ner can be informational in its own right, but also serves as pre-processing for other information extraction (ie) tasks. the web as a data source for ner offers opportunities as a massive corpus of structured information and free text, but also presents challenges of a far from uniform layout and variable writing style; the web is formatted for ease of reading, not for ease of extraction. web page text elements can be divided into two categories: structured and unstructured free text. structured text is contained within records, lists and tables. ner for these elements is usually performed with wrapper methods that identify text areas using precise contextual patterns. html is an essential delimiter of records in wrapper methods. techniques for handling html tags range from string matching to cnn based approaches. wrappers are insufficient for dealing directly with free text. unstructured free text natural language elements, such @xmath0, make up the majority of web content. most recent free text ner approaches make use of sentence based nlp neural network techniques @xcite @xcite , such as bert @xcite or lstm+crf @xcite , with pre-trained language models. html contained in these free text sentences is generally discarded. the reasons for this seem to be expectation, convenience and heritage. html in natural language is not expected to be of any benefit: "free text exhibits no implicit structure at all" @xcite . any information to be extracted from free text is assumed to be held entirely in natural language grammar and semantics. many nlp code libraries, such as beautiful soup @xcite , strip html with a single function call: "since so much text on the web is in html format, we will also see how to dispense with markup." @xcite . a plain text approach to ner is used in various genres of web site, from web newspapers @xcite , the social web (russell, 2013) and websites identified through web search @xcite @xcite to elements of well-researched shared tasks, such as the scientific web page section of bionlp 2013 @xcite and weblog sections of @xcite and ontonotes v5.0 @xcite . in the five datasets used in this paper, html tags make up between 10% and 34% of tokens. html tags have been used in ner, seemingly as a side effect of a combined approach to ner from both structured and free text elements @xcite @xcite . we observe that these approaches typically employ the same split of structured and free text techniques detailed above. to our knowledge, these are the only approaches that make use of html tags in free text areas. supervised ner is the most commonly used approach and has attracted the greatest research effort @xcite , especially related to deep learning @xcite . supervised ner has performed better in f1 terms than semi-supervised in a direct comparison @xcite and on the conll-2003 shared task. in this paper we seek to answer the following questions, which form our contribution: our experiments use five english language datasets of varying characteristics, split into two different free text containing tagsets, split again into text+tags and text-only variants. each html tag is represented by a single token. we assess these datasets and variants over bert and lstm+crf models. we show that the inclusion of html tags improves ner f1 performance over every dataset, tagset and model. pages with a higher tag density correlate fairly well with higher performance gains. the inclusion of tags helps delimit entities, can perform well with any semi-structured elements that might be present and appears to mitigate annotation noise to some extent. these results point to some intriguing future possibilities. html might be included in other websourced nlp tasks, such as knowledge base population or integrated into deep language models trained on the web. ## related work to extract free text from a web page, the level of granularity of free text containing elements must be decided. approaches to free text segmentation range from indiscriminate whole-page approaches to stripping html @xcite . a more granular approach is to use specific html tags that are deemed text containing @xcite , further filtering may then be applied @xcite . to include html tags in sentence based ner, we have a range of options. @xcite and mirończuk (2018) simplify tags, removing attributes and style, including the tag as one standard token. @xcite takes a similar approach, including attributes, splitting into tokens by whitespace. @xcite engineers features to represent aspects of html positions relative to a token. apostolova and tomuro (2014) combine visual and textual page content into engineered features for ner. @xcite use a cnn to automatically extract similar features. ## approach we conduct ner experiments on the five datasets detailed below. these datasets allow sentences, including html tags, to be extracted from the web while applying a supplied gold standard set of entity label annotations or distant supervision. we extract two sets of free text elements and their inner html contents from @xmath1, removing script and comment blocks. set1 @xmath2, set2 @xmath3...> tags and contents. we ignore any structured elements contained in a table record, list item or option. the contents of these elements are then tokenized on whitespace and html tags, including all tags. each tag is simplified into a single token, removing attributes and style. these free text sequences are then sentence segmented using nltk @xcite to create a text+tags variant. html is stripped from each sentence to create a directly comparable text-only variant. "<@xmath4. average sentence length includes html tag tokens. ## results and analysis our results in ## conclusion we investigated whether html tags might improve ner performance by comparing text+tags sentences with their text-only equivalents, over varying datasets, free text segmentation methods and ner models. we used a simplified tags as tokens approach to sentence processing, which required minimal extra pre-processing and between 3% and 11% extra processing time. we observed f1 improvements of between 0.9% and 13.2% for text+tags over all datasets, variants and models. these datasets, variants and models had quite different characteristics, proving the flexibility and adaptability of our approach. this performance points to the inclusion of html in other free text nlp tasks such as knowledge base population or deep language model generation from the web.