Examples of two elementary functions in basic Python 3 (textual data)

Lexical table (words x texts) and Concordance (KWIC: key words in context)

Loading the compressed file of codes and data [folder:"ADT_py"]

The codes of these two elementary functions and their contexts of use are pedagogical examples of the book Analyse des Données textuelles [Textual Data Analysis] (L. Lebart, B. Pincemin, C. Poudat), Presses de l'Université du Québec [in French], 2019.

The Python programming language, whose first version dates back to Guido van Rossum in 1989, is the versatile tool expected by researchers who are working on texts. While being easy to access, this open source language provides a kind of synthesis between script languages ​​such as Perl and classical object-oriented languages ​​such as C ++ or Java. The user can download Python (and for more comfort its IDLE interface) from https://www.python.org and learn interactively using the help buttons available.

The following programs obviously assume that the reader has some knowledge of the basic notions of language. These can be acquired interactively by consulting the Help downloaded with Python (buttons: Help, then Tutorial of the IDLE interface).

The following basic reference cards could be useful (as a terse summary) for beginners:

Example 1 of Python memento card:

Example 2 of Python memento card:

A wealth of books / manuals for learning Python are available on the web.

1- Computation and printing of a lexical table (words X texts)

2- Computation and printing of a concordance from a series of texts