processing

NLTK-chapter1-Language Processing and Python

江枫思渺然 提交于 2019-12-20 03:54:51
书籍地址: http://www.nltk.org/book/ 1. Computing with Language: Texts and Words 1.1 入门准备 Anaconda版本的python自带nltk,但是没有样例数据,需要下载: import nltk nltk . download ( ) 但是由于网络问题,会遇到下载失败或速度慢的问题。解决方法是下载 离线包 。然后需要进行以下步骤: 找到nltk包的data可以解析的路径: print ( nltk . data . path ) 将离线包中packages目录重命名为nltk_data,并放入一个可解析的路径中,将子目录下的压缩包解压 或者通过下面的命令添加自己的路径,但是每次使用nltk时都需要运行下面的命令 nltk . data . path . append ( 'nltk_data的存放路径' ) 检测是否成功 from nltk . book import * 1.2 搜索文本 #查找单词 text1 . concordance ( 'monstrous' ) #查找和目标单词有着相似上下文的单词 text1 . similar ( 'monstrous' ) #查找多个单词的共同的上下文 text2 . common_contexts ( [ 'monstrous' , 'very' ] )

Java math expression parser that can take complex numbers as a variable?

狂风中的少年 提交于 2019-12-20 02:52:20
问题 I am writing a program in Processing that transforms complex numbers. However, I want to have a method of taking an input string and calculating the transformation using a complex variable. For example: 1/(z+1) (z^2)/(z/2) where z is a complex number. Now, I've looked at JEP and some examples, but I cannot work out if it would allow you to actually enter z as a variable (and in any case it is not free). Is there an expression parser for Java (that works in processing, which uses an old

Combining Processing Applications into 1 Big Executable?

一笑奈何 提交于 2019-12-19 10:41:39
问题 I've built these 3 applications. Each of them collects data from user input and creates a csv file. 2 of them rely on the LEAP motion controller. I am trying to figure out a way to combine them all into one program. Any tips on how I could go about doing this? Can I just enclose them into like a class then have the main program call each one individually? Or would I need to go in and rewrtie everything to work together? Each application makes very different use of the draw() with all types of

Setting heap size in IntelliJ IDEA correctly

百般思念 提交于 2019-12-18 04:40:55
问题 I have this peculiar problem with running a Processing application in IntelliJ IDEA. I want to save a large image and to do this I run in to the following exception: Exception in thread "Animation Thread" java.lang.OutOfMemoryError: Java heap space at java.awt.image.DataBufferInt.(DataBufferInt.java:75) at java.awt.image.Raster.createPackedRaster(Raster.java:467) at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032) at java.awt.image.BufferedImage.

How to filter FFT data (for audio visualisation)?

半城伤御伤魂 提交于 2019-12-17 21:52:58
问题 I was looking at this Web Audio API demo, part of this nice book If you look at the demo, the fft peaks fall smoothly. I'm trying to do same with Processing in Java mode using the minim library. I've looked at how this is done with the web audio api in the doFFTAnalysis() method and tried to replicate this with minim. I also tried to port how abs() works with the complex type: / 26.2.7/3 abs(__z): Returns the magnitude of __z. 00565 template<typename _Tp> 00566 inline _Tp 00567 __complex_abs

Removing element from ArrayList every 500 frames

拟墨画扇 提交于 2019-12-17 21:13:05
问题 I have this arraylist: // Add predators predators = new ArrayList(); for (int i = 0; i < predNum; i++) { Creature predator = new Creature(random(width), random(height), 2); predators.add(predator); } How can the statement be structured so that the last element from the predators arraylist is removed every 500 frames? Does it need a loop of some sort? if (frameCount == 500){ predators.remove(1) } 回答1: If you already have a variable that keeps track of what frame you are on, you can use this if

How to add +1 to variable every 10 seconds in Processing?

我怕爱的太早我们不能终老 提交于 2019-12-17 17:28:11
问题 Excuse my ignorance, but I ran into a problem that turned out to be challenging for my current knowledge in programming with Processing, even though the idea is quite simple. You see, I need to add 1 unit to a variable every 10 seconds. This is the code: int i = 0; void setup() { frameRate(60); } void draw() { int time = (millis() % 10000) / 1000; if (time == 9) { i++; } else {} System.out.println("-------------------------------\n" + "Timer: " + time + "\n" + "Adding 1 every 10 seconds: : "

How to create something happen when time = x

社会主义新天地 提交于 2019-12-17 17:11:53
问题 I have a question about timers in Processing. I want to make a square spawn after every second that passes. Would I use a for loop, an if statement, etc.? 回答1: You could just use the millis() function or the frameCount variable in an if statement. Something like this: void draw(){ if(frameCount % 60 == 0){ //do something } } More info can be found in the reference. 来源: https://stackoverflow.com/questions/43210260/how-to-create-something-happen-when-time-x

PHP - windows下编译PHP 7.2的memcache

那年仲夏 提交于 2019-12-16 11:06:07
概述 PHP 7.2出来有一段时间了,不出意料,memcache又不能用了,于是又想到要自己动手编译,不过与我编译PHP 7.1的memcache的时候相比,有个好消息是已经有人把PHP 7.1和7.2 的memcache都编译好并放在github上了,需要的可直接去那里下载,我这篇文章就不提供下载了: https://github.com/nono303/PHP7-memcache-dll 注:这里还是要强烈吐槽一下百度,以“php 7.2 memcache”为关键字,完全搜索不到任何有用的东西,上面那个网址我是用google一下子就搜到了,而且还受到启发,顺利的把编译过程给搞定,所以搞开发的遇到技术问题,还是不要在百度上浪费生命了。 我下面还是把我研究出来的PHP 7.2 memcache的编译方法写出来,给有需要的人做个参考吧。 PHP 7.2的memcache编译方法跟之前版本有了一些变化,主要体现在: PHP SDK的下载路径与编译方式发生了改变; PHP 7.2的memcache要使用VC15编译; 下载文件 编译前需要下载如下文件: 编译环境: PHP-memcached是用VC15编译的,因为并不常用VC15,所以到微软的官网上下载visual studio 2017 entrpise的试用版即可。 地址: https://www.visualstudio.com

虚拟机中标麒麟操作系统gcc安装

≡放荡痞女 提交于 2019-12-14 08:02:15
虚拟机中标麒麟操作系统gcc安装 一、安装包安装 1.右键虚拟机**“设置”**–“ CD/DVD ”–“ 使用镜像文件 ”,选择操作系统镜像 注意:勾选“已连接” 2.进入虚拟机,以 root账号登录 。 进入“计算机”–“操作系统光盘”–“Packages”,将以下文件复制到“文件系统”的任一文件夹内。 cpp-4.4.5-6.el6.ns6.01.x86_64.rpm gcc- .x86_64.rpm glibc-devel- .x86_64.rpm glibc-headers- .x86_64.rpm kernel-headers- .x86_64.rpm libmpcdec- **.x86_64.rpm mpfr-***.x86_64.rpm 运行rpm -Uvh *.rpm --nodeps --force 安装成功后 gcc -v 验证。 二、yum源配置 1.配置YUM源: [root@px unixODBC-2.3.0]# cd /etc/yum.repos.d/ ns6.repo [root@px yum.repos.d]# rm -rf ns6.repo [root@px yum.repos.d]# touch dave.repo(创建一个新的) [root@px yum.repos.d]# cat dave.repo [root@px yum.repos.d