Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
| Entrambe le parti precedenti la revisione Revisione precedente Prossima revisione | Revisione precedente | ||
|
distribuzione_delle_frequenze [2021/06/02 20:04] admin |
distribuzione_delle_frequenze [2024/07/07 18:48] (versione attuale) admin |
||
|---|---|---|---|
| Linea 31: | Linea 31: | ||
| import re | import re | ||
| import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||
| - | with open(' | + | f = open(' |
| + | testo = f.read() | ||
| testo=testo[1704: | testo=testo[1704: | ||
| + | |||
| + | # istruzioni per l' | ||
| testo=re.sub("'","' | testo=re.sub("'","' | ||
| testo=re.sub(" | testo=re.sub(" | ||
| testo=testo.lower() | testo=testo.lower() | ||
| + | # fine istruzioni per l' | ||
| + | |||
| testo=testo.split() | testo=testo.split() | ||
| fd=[testo.count(i) for i in set(testo)] | fd=[testo.count(i) for i in set(testo)] | ||
| Linea 44: | Linea 49: | ||
| ---- | ---- | ||
| Il codici seguente usano una lista di tuple, denominata " | Il codici seguente usano una lista di tuple, denominata " | ||
| - | <code python | + | <code python |
| frase=' | frase=' | ||
| frase=frase.split() | frase=frase.split() | ||
| Linea 59: | Linea 64: | ||
| - | <code python | + | <code python |
| + | import re | ||
| import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||
| - | with open(' | + | f = open(' |
| + | testo = f.read() | ||
| + | testo=testo[1704: | ||
| + | # istruzioni per l' | ||
| testo=re.sub("'","' | testo=re.sub("'","' | ||
| + | testo=re.sub(' | ||
| testo=testo.lower() | testo=testo.lower() | ||
| - | # altre istruzioni per l' | + | # fine istruzioni per l' |
| - | # ... | + | |
| testo=testo.split() | testo=testo.split() | ||
| Linea 77: | Linea 86: | ||
| plt.show() | plt.show() | ||
| </ | </ | ||
| + | |||
| + | {{:: | ||