I'm trying to generate a random co-occurrence matrix for words in a corpus. The idea is say the probability of word A's occurrence is 7/200 (7 times in a 200 words corpus) and B is 19/200 (19 time in the same corpus), I want to generate an occurrence number of A and B, with in range of 7 and 19, based on the probability 7/200 and 19/200. I understand that there are functions like `random.choices`

to pick a number from a list but it does not seem to solve this problem. Many thanks for your help.

评论

请 登录后发表观点

暂无数据

- 积分
**0** - 话题
**0** - 评论
**3233** - 注册排名
**2656**