File size: 1,136 Bytes
3ceaaa9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import matplotlib
import matplotlib.pyplot as plt
import sys
import operator
import argparse
import pandas as pd
import numpy as np

filename = "ml.vocabfreq.tsv"
data=pd.read_csv(filename,sep='\t')
data.columns=['word', 'frequency']
data.head()
data['rank'] = np.arange(len(data))+1
data.head()


fig1, ax1 = plt.subplots(figsize=(40,20))
ax1.set_title("Frequency Profile of IndicNLP Corpus ",  fontsize=80)
ax1.set_ylabel("Token Frequency", fontsize=70)
ax1.set_xlabel("Rank in the frequency list", fontsize=70)
goldrank=data['rank'][0:999]
goldfreq=data['frequency'][0:999]

ax1.loglog(data['rank'], data['frequency'],color='#00629B', linewidth=7.0,label='Token frequency')
ax1.fill_between(goldrank, goldfreq, color='#D5E8D4', alpha=0.9,label='Coverage of gold standard lexicon' )
ax1.legend(fontsize=60)
# ax1.set_yticks([1,3, 10,100,1000,10000])
# ax1.set_xticks([1, 400000])
ax1.tick_params(axis='both', labelsize=50)
# ax1.get_xaxis().set_major_formatter(matplotlib.ticker.ScalarFormatter())
# ax1.get_yaxis().set_major_formatter(matplotlib.ticker.ScalarFormatter())
ax1.grid(linewidth=3)

plt.savefig("rank.png")
# plt.show()