当我尝试在python 3.2中绘制Word Vector时,我的乌尔都语文本显示不正确

时间:2017-05-02 09:38:23

标签: python python-3.x

我想绘制URDU文本的单词向量。当我编译源代码时,它执行得相当,但是在结果图中出现空白框而不是乌尔都语文本。我需要乌尔都语文本而不是盒子。这是我的源代码:

import numpy as np
import codecs
la = np.linalg

words = ['امریکی','صدر','خبردار','شمالی کوریا','کے','میزائل','اور','.']
arr = np.array([[0,2,1,0,0,0,0,0],
                [2,0,0,1,0,1,0,0],
                [1,0,0,0,0,0,1,0],
                [0,0,0,1,0,0,0,1],
                [0,1,0,0,0,0,0,1],
                [0,0,1,0,0,0,0,8],
                [0,2,1,0,0,0,0,0],
                [0,0,1,1,1,0,0,0]])
u, s, v = la.svd(arr, full_matrices=False)

import matplotlib.pyplot as plt 
for i in range(len(words)):
    plt.text(u[i,2], u[i,3], words[i])

plt.show()

enter image description here

0 个答案:

没有答案