GithubHelp home page GithubHelp logo

词向量的问题 about ner HOT 3 OPEN

shiyybua avatar shiyybua commented on September 2, 2024
词向量的问题

from ner.

Comments (3)

zhuruizhuruiqiang avatar zhuruizhuruiqiang commented on September 2, 2024
   try:
        coefs = np.asarray(values[1:], dtype='float32')  # 取向量
    except ValueError:
        # 如果真的这个词出现在了训练数据里,这么做就会有潜在的bug。那coefs的值就是上一轮的值。
        print values[0], values[1:]

将其修改为:
try:
#print("try",index,len(values))
if len(values)<embeddings_size:
coefs = np.asarray(values[1:], dtype='float32') # 取向量
elif len(values)==embeddings_size:
coefs = np.asarray(values, dtype='float32') # 取向量
else:
coefs = np.asarray(values[len(values)-embeddings_size:], dtype='float32') # 取向量
except ValueError:
# 如果真的这个词出现在了训练数据里,这么做就会有潜在的bug。那coefs的值就是上一轮的值。
#print(values[0], values[1:])
#print("try",index,len(values))
print(index,"error",len(values),values[0])

之后代码可以调通

from ner.

plb31949 avatar plb31949 commented on September 2, 2024

@zhuruizhuruiqiang 其实这个问题是因为有一个词是空格,所以在截取之后会导致空格的那一行的第一个坐标被认为是词,所以长度会比正常的短一位

from ner.

hsingyang avatar hsingyang commented on September 2, 2024

@zhuruizhuruiqiang 请教下,HashTable has different value for same key.的错误如何解决?删除重复词语吗?

from ner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.