1 / 12

NLTK y el acceso a textos Día 12, 10 ene 14

NLTK y el acceso a textos Día 12, 10 ene 14. Cultura computacional en español SPAN 4350 Harry Howard Tulane University. Organizaci ón del curso. Las grabaciones y las presentaciones están disponibles en: http://www.tulane.edu/~howard/SPAN-NLP/

zazu
Télécharger la présentation

NLTK y el acceso a textos Día 12, 10 ene 14

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NLTK y el acceso a textosDía 12, 10 ene 14 Cultura computacional en español SPAN 4350 Harry Howard Tulane University

  2. Organización del curso • Las grabaciones y las presentaciones están disponibles en:http://www.tulane.edu/~howard/SPAN-NLP/ • La versión en inglés del tema es http://www.tulane.edu/~howard/CompCultES/regex.html SPAN 4350 - Harry Howard - Tulane University

  3. Repaso SPAN 4350 - Harry Howard - Tulane University

  4. Tabla de caracteres de clase SPAN 4350 - Harry Howard - Tulane University

  5. Métodos sencillos para tokenizar >>> re.split(r' ',S) >>> re.split(r'\s',S) SPAN 4350 - Harry Howard - Tulane University

  6. NLTK SPAN 4350 - Harry Howard - Tulane University

  7. NLTK >>> importnltk Si hay un error, abren al app de Canopy > Package Manager > CanopyPackages > nltk 2.01 >>> importnltk >>> nltk.download() SPAN 4350 - Harry Howard - Tulane University

  8. Bajar un texto en español de PG • http://www.gutenberg.org/wiki/Main_Page • Main Page > Browse Catalog > Spanish > Cervantes Saavedra, Miguel de, 1547-1616 > Novelas y teatro > Plain Text UTF-8 • Bájalo a tu computadora. • Cámbiale el nombre de 15115.txt.utf-8 a CervantesTeatro.txt. • raíz/nltk_data/corpora/textos • Mete CervantesTeatro.txt allí. • Trata de abrirla. SPAN 4350 - Harry Howard - Tulane University

  9. Desvío: directorios en Python >>> import os >>> os.getcwd() '/Users/harryhow' *** El sendero a mis ficheros es: /Users/harryhow/nltk_data/corpora/textos *** >>> raiz = '/Users/harryhow/nltk_data/corpora/textos' >>> raiz '/Users/harryhow/nltk_data/corpora/textos' >>> os.chdir(raiz) >>> os.getcwd() '/Users/harryhow/nltk_data/corpora/textos' >>> os.listdir('.') ['CervantesTeatro.txt', 'Gitanilla.txt'] SPAN 4350 - Harry Howard - Tulane University

  10. Abrir el texto >>> raiz = '/Users/harryhow/nltk_data/corpora/textos' >>> from nltk.corpus import PlaintextCorpusReader >>> texto = PlaintextCorpusReader(raiz, 'CervantesTeatro.txt') >>> git = texto.words() >>> git[:50] ['LA', 'GITANILLA', 'Parece', 'que', 'los', 'gitanos', 'y', 'gitanas', 'solamente', 'nacieron', 'en', 'el', 'mundo', 'para', 'ser', 'ladrones', ':', 'nacen', 'de', 'padres', 'ladrones', ',', 'cr\xedanse', 'con', 'ladrones', ',', 'estudian', 'para', 'ladrones', 'y', ',', 'finalmente', ',', 'salen', 'con', 'ser', 'ladrones', 'corrientes', 'y', 'molientes', 'a', 'todo', 'ruedo', ',', 'y', 'la', 'gana', 'del', 'hurtar', 'y'] SPAN 4350 - Harry Howard - Tulane University

  11. Funciones del PlaintextCorpusReaderTabla 2.3 SPAN 4350 - Harry Howard - Tulane University

  12. Empezar a trabajar con el texto en NTLK El próximo díaTráete el portátil a clase. SPAN 4350 - Harry Howard - Tulane University

More Related