Skip to content

Information extraction in the WWW: technology and tools for problem solving / Extracción de información en la web, tecnología y herramientas para resolver la problemática

November 18, 2011

The World Wide Web is undoubtedly the biggest container of information that has ever been created in the human history; there is no library in the world that has even one millionth of the amount of information the WWW contains. This system of information based on hypertext allows us to access an infinite number of documents enriched with images and multimedia.

The WWW is designed to be used with the so-called web browsers; friendly applications for visualizing documents which permit anyone with basic knowledge of computers to immediately access a vast network of information.

Figure 1. Internet (image taken from http://www.unc.edu).

However, the WWW can be exploited in many other ways; for instance, it can be seen as a massive source of data that can be processed in models, with the aim of making analysis or applications, or used in creating other information systems.

As you can imagine, a web browser which has been originally created for the WWW is not appropriate for the task of extracting large numbers of information since it would not be feasible to make a group of people use web browsers to search for and extract huge amounts of data manually.

Figur3 2. Manual Information Extraction (image taken from http://topnews.net.nz/).

There exist different tools and strategies for dealing with this welter of information. One of the biggest problems when extracting large amounts of information from the WWW isshortage of indicators or semantic metadata (Semantic Web), as well as lack of order or common structure.

Such indicators could be superficially read by computer programs to find out what type of information a given document contains, and if there were some sort of order it would be possible to locate a large amount of information at the same time. Unfortunately, that is not the case and each document (website, PDF document, Word Document, etc) has its own order and lacks semantic metadata, which is why we have to create patterns for detecting information.

We now face two challenges: to know what the information contained in a document means, and where it is located. Furthermore, there is another question we have to answer: where do we find these documents?

We also have to differentiate between two big groups of documents: those written in natural language, and the semi-structured ones (which may contain blocks of information written in natural language)

The first group of documents represents any text written by a given person in natural language. In this case we cannot follow any order, but we should make use of tools which are specially designed to process natural language.

Figure 3. Natural Language(image taken from http://www.adaspirant.com).

To extract information from natural language, the following tasks have to be performed: tokenization, sentence segmentation, grammar labelling, name extraction, analysis and co-referentiality of names.

The second group contains documents based on hypertext, most of which have been created by other computer programs in HTML format. Previously people would build their websites according to their needs and tastes, but today, in the era of dynamic WWW, big groups of documents from one place are created in the same way, with the same order and structure.

Figura 4. HTML tags (image taken from http://www.racineweb.com).

To extract data from a group of documents, we should use reverse engineering to obtain their structure, and HTML parsers to locate and extract information (this process is known as Web scraping). Note that there are some web documents which require tools for processing natural language.

However, if we do not have documents and must look for them on the web, we should use the so-called web crawlers, which examine web documents by following links systematically and automatically.

Figura 5. Web crawler.

Here is a list of tools for dealing with problems that may occur when extracting massive quantities of information from the WWW.

Location of documents in the WWW:

Crawler4j (http://code.google.com/p/crawler4j/)

Crawler4j is a simple web crawler with open-source efficient license written in Java. CrawlerJ can search and check hundreds of document in no time. It offers a decision block to determine whether a given link should be visited or not, and another one for processing the content of a document. The crawler needs seed values (websites) to work.

Document location and extraction for specific sites (scraping):

Web Harvest (http://web-harvest.sourceforge.net/)

Web Harvest is an example of end-user software for data extraction from sites with specific structures. The software has his owns language for code extraction patterns.

JSOUP (http://jsoup.org/)

JSOUP is a library written in Java that offers an HTML parser of real world documents and allows extracting information from documents with DOM and CSS selectors.

SCRAPY (http://scrapy.org/)

A high-level framework written in Python, used to crawl websites and extract structured data from them

HTMLAGILITYPACK (htmlagilitypack.codeplex.com/)

Another parser like JSOUP that works with HTML documents of WWW, also written in C#.

WATIR (http://watir.com/)

Watir is an open-source library written in Ruby for automating web browsers. It clicks links, fills in forms, presses buttons, etc. Many web pages show their contents using Javascript, which makes the tools mentioned above useless as they can read only hypertext, not the text generated by JavaScript.

Slavy:

Slavy is a library written in Python to create information agents capable of searching for or extracting data from the web. The agents can also communicate with one another. At the moment the tool is not open-source.

Processing natural language:

GATE (http://gate.ac.uk/):

GATE is an open-source platform for creating applications based on processing of information in natural language. The main components of GATE are: GATE EMBEDDED and GATE DEVELOPER. The first consists of GATE nucleus (coded in JAVA) and can be integrated into Java applications in the form of library. GATE DEVELOPER is, however, a complete application which uses the GATE nucleus to process information interactively. It can be viewed as an interactive tool to manually design and adjust the extraction patterns before applying them to the rest of the documents.

Figura 6. GATE DEVELOPER.

In addition, GATE has a high level of maturity and has numerous plugins available to facilitate different information extraction tasks.

OpenNLP (http://incubator.apache.org/opennlp/):

The Apache OpenNLP library is a machine learning based toolkit for the processing of natural language text. It is written in Java, supported by Apache and available as a simple external library.

Author: Daniel López

La World Wide Web es con total seguridad el mayor contenedor de información jamás creado en la historia de la humanidad, ninguna biblioteca del mundo ha tenido ni la millonésima cantidad de información contenida en la web. Este sistema de información distribuida basada en el hipertexto permite a las personas acceder a infinidad de documentos enriquecidos con imágenes y contenido multimedia mediante una conexión a Internet.

La World Wide Web ha sido concebida para ser utilizada con los llamados navegadores web, aplicaciones amigables que visualizan los documentos de la web haciendo que cualquier persona con unos mínimos conocimiento informáticas tenga acceso a una vasta red de información de manera inmediata.

Figura 1. Internet ( imagen tomada de http://www.unc.edu).

Pero lo cierto es que la web como contenedor de información, puede ser explotada de otras muchas maneras, por ejemplo puede ser vista como una fuente masiva de datos e información para su posterior tratamiento en modelos propios con el objeto de realizar estudios, aplicaciones o simplemente para crear otros sistemas de información.

Como se puede imaginar, el navegador web, la herramienta ideada en principio para la web, se vuelve estéril para enfrentar esta tarea, ya que sería inviable poner a un grupo de personas con navegadores web para encuentren y extraigan la información requerida de forma manual, al menos si queremos una gran cantidad de datos.

Figura 2. Extracción manual de datos (imagen tomada de http://topnews.net.nz/).

Para intentar resolver esta tarea existen diversas herramientas y estrategias que nos permiten atacar a este maremágnum de información. Porque uno de los grandes problemas a la hora de extraer información de manera masiva de la World Wide Web es la ausencia de indicadores o metadatos semánticos (Web Semántica), así como la carencia de orden o estructura común.

Estos indicadores podrían ser leídos fácilmente por programas informáticos para saber qué tipo de información contiene el documento y de haber algún orden, también sería posible localizar la información rápidamente en todos los documentos que siguieran dicho orden. Sin embargo la realidad no es así y cada documento (página web, pdf, documento word, etc) tiene su propio orden y carece de metadatos semánticos por lo que hay que elaborar patrones para detectar la información.

De este modo se nos presentan dos retos principales, saber que significa la información contenida en un documento y donde está localizada. Además, se nos presenta otro reto complementario si no disponemos de esos documentos, ¿dónde están encontrar esos documentos?

Por otro lado, deberemos diferenciar dos grandes grupos de documentos, los escritos en lenguaje natural y los documentos semi-estructurados (dentro de un documento semi-estructurado podemos encontrarnos bloques de información escrita en lenguaje natural).

Los primeros tipos de documentos representan cualquier texto escrito por una persona de manera natural, en este caso no podremos agarrarnos a ningún posible orden y deberemos hacer uso de herramientas específicas para el procesamiento de lenguaje natural (NPL).

Figura 3. Lenguaje natural (imagen tomada de http://www.adaspirant.com).

Las tareas necesarias para extraer información en lenguaje natural son: la tokenización, segmentación de frases, etiquetado gramatical, extracción de nombres, análisis y relación co-referencial de nombres.

El segundo grupo representa los documentos basados en hipertexto, creados en su mayoría por otros programas informáticos en formato HTML. Antiguamente cada persona hacía su web con la estructura que creía conveniente, pero hoy en día con la web dinámica, grandes grupos de documentos de un mismo sitio son creados de la misma manera con un mismo orden y estructura.

Figura 4. Etiquetas HTML (imagen tomada de http://www.racineweb.com).

Para extraer datos de este grupo de documentos deberemos hacer uso de la ingeniería inversa para obtener su orden y utilizar lectores (parsers) de documentos HTML para localizar y extraer la información (lo que se conoce como Web scraping). Nótese que en documentos webs muy particulares deberemos hacer uso de herramientas para el lenguaje natural.

Se nos presenta otro reto si no tenemos los documentos y tenemos que buscarlos en la WWW, este problema se aborda con la utilización de las llamadas arañas web (crawlers), un tipo de software que examina los documentos web, siguiendo los enlaces de una forma mecánica y automatizada.

Figura 5. Web crawler.

Listado de posibles herramientas para los diferentes problemas a la hora de extraer información de manera masiva de la World Wide Web:

Localización de documentos en la World Wide Web:

Crawler4j (http://code.google.com/p/crawler4j/)

Crawler4j es araña web bajo licencia libre, rápida, eficiente y optimizada escrita en Java. Crawler4j permite navegar e inspeccionar miles de documentos en poco tiempo, además proporciona un bloque de decisión para determinar si debemos visitar o no un enlace y otro bloque para tratar el contenido web o la dirección web obtenida del documento inspeccionado. El crawler necesita de valores semilla (sitios webs) para comenzar a funcionar.

Localización y extracción de documentos para sitios determinados (scraping):

Web Harvest (http://web-harvest.sourceforge.net/)

Web Harvest es una aplicación final para tareas de extracción de datos contra sitios con estructura específica. El software tiene su propio lenguaje para codificar los patrones de extracción.

JSOUP (http://jsoup.org/)

JSOUP es una librería escrita en Java que ofrece un analizador de documentos HTML del mundo real y que permite extraer información de los documentos mediante selectores DOM y CSS.

SCRAPY (http://scrapy.org/)

Framework de alto nivel escrito en Python para acometer tareas de scraping.

HTMLAGILITYPACK (htmlagilitypack.codeplex.com/)

Otro parser HTML preparado para trabajar con los documentos de la web escrito en C#.

WATIR (http://watir.com/)

Watir es una librería escrita en Ruby para tareas de automatización de navegadores web, permite pinchar enlaces, rellenar formularios, presionar botones, etc. Muchas páginas muestran contenido con JavaScript lo que deja inútiles las herramientas anteriores, ya que éstas solo leen el contenido del hipertexto no lo que produce el código JavaScript contenido en el documento.

Slavy:

Slavy es una librería escrita en Python para crear agentes de información capaces de navegar y extraer datos  de la web, los agentes además pueden comunicarse entre sí entre otras muchas cosas. La herramienta de momento no está abierta al público pero se darán más detalles próximamente en el blog con una noticia dedicada a Slavy y sus posibilidades.

Procesamiento del lenguaje natural:

GATE (http://gate.ac.uk/):

Una plataforma de código abierto con herramientas para crear aplicaciones basadas en el procesamiento de la información en lenguaje natural. Los dos principales componentes de la plataforma GATE son: GATE EMBEDDED, GATE DEVELOPER. El primero consiste en el núcleo de GATE (codificado en Java) y es integrable en aplicaciones Java en forma de librería. GATE DEVELOPER, sin embargo, es una completa aplicación que utiliza el núcleo de GATE para tratar la información de manera interactiva. Puede verse como un panel de control previo a la automatización masiva para ir diseñando los patrones de extracción, en DEVELOPER podremos ver la información que hemos extraído en forma de marcados coloreados.

Figura 6. GATE DEVELOPER.

Por último decir de GATE que tiene un alto grado de madurez y tiene tras su espaldas cientos de plugins para facilitar las tareas de la extracción de la información.

OpenNLP (http://incubator.apache.org/opennlp/):

Se trata de otra herramienta libre para el NPL, soporta las tareas más comunes para abordar el problema, está escrita en Java y se presenta como una librería de sencilla integración. Sobra decir que está respaldada por Apache por lo que podemos hacernos una idea de su calidad.

Autor: Daniel López

4 Comments leave one →
  1. Yusnelkis Milanés permalink
    November 18, 2011 12:32

    Interesante este post y útil para medir la visibilidad social de los resultados científicos en la web. Si logramos establecer un símil entre la web y la sociedad (vista a través de los dominios sociales presentes en la web), con este tipo de herramientas y diseñando los indicadores adecuados, pudiéramos acércanos bastante (en plan indicadores proxy), a la obtención de un impacto social de la ciencia.

  2. December 7, 2011 15:55

    Hi from Japan. Apologize for my poor English. I used Google’s translator on your webpage just to tell you how awesome I think it is! Take Care!

  3. December 19, 2012 22:19

    If you are going for most excellent contents like myself, simply
    go to see this site all the time as it provides feature contents, thanks

Trackbacks

  1. Generating conceptual maps from web-based information / Generación de mapas conceptuales a partir de información en la web «

Leave a comment