英语文章单词出现次数
Ⅰ 有没有能统计一篇英文文章中所有单词出现次数的软件
对不起,复我来晚啦。
我用过一制个软件。
功能如下:1)英语单词文本中单词个数统计,标注音标和翻译,并支持导出为Excel文件。2)支持点击统计的单词,查看单词在文本中的分布。用背景色标注显示。3)支持自己添加过滤词。4)支持对比两个Excel文件第一列单词的异同,并导出对比情况,方便查看两分文本单词的差异。5)对于英语单词进行词形还原处理。避免went和gone统计程不同的单词。
提取码: k6ei
Ⅱ 在 word文档里如何统计英文单词出现的次数
可以通过快捷键ctrl+F查找,在弹出搜索框中输入单词,点击搜索全部,即可统计单词出现次数。
Ⅲ 统计一篇英文文章的英文单词个数
/*
本程序由Turbo C2.0编译通过。英文文章请命名为english.txt并放在Turbo C所在目录下。运行结果以文件方式输出,输出文件result.txt也在Turbo C所在目录下。
word是不同的单词;
count是该单词在文章中出现的次数;
percent是文章中各单词出现的频率。
*/
#include "stdio.h"
main()
{
FILE *fp,*result;
char ch='\0';
char word[1000][20]; /* 最多存1000个不同单词,每个单词在20个字符内。 */
int count_word[1000]={0}; /* 每个单词对应个数 */
int i=0,j=0,k=0,flag=2,total=0;
float percent; /* 每个单词出现频率 */
clrscr();
if(((fp=fopen("english.txt","r"))&&(result=fopen("result.txt","w")))==NULL)
{
printf("Can't open file\n");
printf("Press any key to exit...");
getch();
exit(0);
}
printf("\nPlease wait...");
while(!feof(fp))
{
ch=fgetc(fp);
if(ch>='a'&&ch<='z'||ch>='A'&&ch<='Z')
{
if(ch>='A'&&ch<='Z') ch+=32;
flag=0;
word[i][j]=ch;
j++;
}
else flag++;
if(flag==1)
{
total++;
word[i][j]='\0';
count_word[i]++;
for(k=0;k<i;k++)
{
if(strcmp(word[i],word[k])==0)
{ count_word[k]++; count_word[i]=0; i--; break; }
}
i++;
j=0;
}
}
fprintf(result,"words count percent\n");
fprintf(result,"----------------------------------------");
for(k=0;k<i;k++)
{
fprintf(result,"\n%-20s",word[k]);
fprintf(result,"%-10d",count_word[k]);
percent=100.0*count_word[k]/total;
fprintf(result,"%.2f%%",percent);
}
fprintf(result,"\n\nThis text has %d word(s).",total);
fprintf(result,"\nAnd here has %d different word(s).",i);
fclose(fp);
fclose(result);
printf("OK!\n");
printf("Press any key to exit...");
getch();
printf("Bye bye!");
exit(0);
}
---------
以下是用c++编写
#include <iostream>
#include <fstream>
#include <cstdlib> // for exit()
#include <list>
#include <string>
using namespace std;
template <typename T>
void writeList(const list<T>& alist, const string& separator);
// maintains a word and its frequency of occurrence
class wordFreq
{
public:
// initialize word and set freq to 1
wordFreq(const string& str): word(str), freq(1)
{}
// add 1 to the frequency
void increment()
{ freq++; }
// equality operator compares the word for the objects
friend bool operator== (const wordFreq& lhs, const wordFreq& rhs)
{ return lhs.word == rhs.word; }
// less than operator compares the word for the objects
friend bool operator< (const wordFreq& lhs, const wordFreq& rhs)
{ return lhs.word < rhs.word; }
// output an object in the format: word (freq)
friend ostream& operator<< (ostream& ostr, const wordFreq& w)
{
ostr << w.word << " (" << w.freq << ')';
return ostr;
}
private:
string word;
// number of times word found
int freq;
};
template <typename T>
list<T>::iterator seqSearch(list<T>::iterator first,
list<T>::iterator last, const T& target);
int main()
{
ifstream fin;
// words read from file and inserted into wf
list<wordFreq> wf;
// use for seqSearch() and displaying the list
list<wordFreq>::iterator iter;
// prompt for the name of the file
string fileName, word;
cout << "Enter the name of the file containing the words: ";
cin >> fileName;
// error checking
fin.open(fileName.c_str());
if (!fin)
{
cerr << "Cannot open " << fileName << endl;
exit(1);
}
// read a word until end-of-file
while (fin >> word)
{
// declare a wordFreq object with frequency 1
wordFreq obj(word);
// search for word in the list wf
iter = seqSearch<wordFreq> (wf.begin(), wf.end(), obj);
// did we locate the word?
if (iter != wf.end())
// yes. increment the word frequency
(*iter).increment();
else
// word is new. insert obj into the list
wf.push_back(obj);
}
// list member function sort() orders the list
wf.sort();
// output each object on a separate line
cout << endl;
writeList(wf, "\n");
system("pause");
return 0;
}
template <typename T>
list<T>::iterator seqSearch(list<T>::iterator first,
list<T>::iterator last, const T& target)
{
// start at location first
list<T>::iterator iter = first;
// compare list elements with item until either
// we arrive at last or locate item
while(iter != last && !(*iter == target))
iter++;
// iter either points at item or is last
return iter;
}
template <typename T>
void writeList(const list<T>& alist, const string& separator = " ")
{
list<T>::const_iterator iter;
for (iter = alist.begin(); iter != alist.end(); iter++)
cout << *iter << separator;
cout << endl;
}
Ⅳ 有没有软件可以把英语文章中每个词都挑出来,然后计算每个单词在文章中出现的总次数
没有, 不过如果我是你, 我会这么做。 如果 你的文章是在电脑上,专 我只要把她复制到microsoft word 2003或者是属2007, 然后到替换(也就是体会单词, 在编辑这一栏里),把你想要知道的有多少个这样的单词输进去,然后随便说你想要把这个单词换成别的单词, 然后选替换全部,这样,会告诉你 你替换了多少个单词, 这样你不就知道这个单词在这篇文章你出现了多少次了?
Ⅳ 在一篇文章中查找某个单词出现的次数
这是第一个在运行时先输入一篇英语文章然后回车,接着输入想查的单词再回车就可以了。#include <stdio.h>
#include <string.h>
void change(char s[])
{
int i;
for(i=0;i<=100;i++)
{
if(s[i]>='A'&&s[i]<='Z')
{
s[i]+=32;
}
}
}
main()
{ int i=0,j=0;
int occur=0;
char s1[100],s2[50];
printf("please input two strings\n");
printf("S1: \n");
gets(s1);
change(s1);
printf("s2: \n");
scanf("%s",s2);
change(s2);
while(s1[j]!='\0')
{ if ((s1[j]==s2[i])&&(s2[i]!='\0'))
{ i++; j++; }
else
j++;
if (s2[i]=='\0')
{ occur++;
i=0; }
}
printf("\nNumber of occurances: %d.\n", occur);
}这是第二个,就是先把一篇文章存成txt文档,然后存入一个指定的文件夹中,在运行时只需输入需要查找的单词就可以了,要回车哟~~#include<stdio.h>
#include<string.h>
#define MAX_size 1000
int flag=1,degree=0;
void change(char s[])
{
int i;
for(i=0;i<=1000;i++)
{
if(s[i]>='A'&&s[i]<='Z')
{
s[i]+=32;
}
}
}
void Index(char str[],char word[],int position[])
{
int i,len_str,len_word,pos_str,pos_word,k=0,word_number=0;
len_word=strlen(word);
len_str=strlen(str);
for(i=0;i<len_str;i++)
{
while(str[i]==' '||str[i]==','||str[i]=='.')
i++;
word_number++;
for(pos_str=i,pos_word=0;pos_str<len_str && pos_word<len_word;pos_str++,pos_word++)
{
if(str[pos_str]!=word[pos_word])
break;
}
if(pos_word==len_word && (str[pos_str]=='\0'|| str[pos_str]==' '||str[pos_str]==','||str[pos_str]=='.'))
{
position[k++]=word_number;
degree++;
flag=0;
}
else
{
while(str[pos_str]!=' '&&str[pos_str]==','&&str[pos_str]=='.'&& pos_str<len_str)
pos_str++;
}
i=pos_str;
}
}
void main()
{
char str[MAX_size],word[20],ch;
int position[100],i; int k=0;
FILE *fp; if((fp=fopen("d:\\temp.txt","r"))!=NULL)
{
while(1)
{
ch=fgetc(fp);
if(ch==EOF) break;
str[k]=ch;
k++;
}
}
change(str);
printf("请输入要检索的单词: \n");
gets(word);
change(word);
Index(str,word,position);
if(flag)
printf("您输入的单词不在短文中。\n");
else
{
printf("您输入的单词在短文中,它共出现 %-d 次\n",degree);
}
fclose(fp);
}
Ⅵ 统计文本文件中英文单词的出现次数用C语言
定义一个结构体数组,结构体里面两个元素,一个是该单词的个数,一个专是该单词的属拼写
然后去读文章,以非英文字母作判断,截取单词,然后和结构体数组比较,如果是新单词则放入一个新结构体中,个数设为1,如果该单词已存在,则把该结构体个数+1,最后比较个个结构的个数进行排序即可。
Ⅶ 统计一篇英文文章中的所有单词出现的次数,按照这些单词出现的顺序依次打印它们以及各自出现的次数。
定义一个结构体数组,结构体里面两个元素,一个是该单词的个数,内一个是该单词的拼写容
然后去读文章,以非英文字母作判断,截取单词,然后和结构体数组比较,如果是新单词则放入一个新结构体中,个数设为1,如果该单词已存在,则把该结构体个数+1,最后比较个个结构的个数进行排序即可。
Ⅷ 如何统计一篇英语文章单词重复出现的次数
把它复制到word文档里,然后在编辑里在编辑里点击替换,输入你的单词全部替换成你的单词(和上个单词一样),替换后就会告诉你替换了多少处,那就是出现的次数了
Ⅸ C语言:统计一篇英文文章中所要查询单词出现的次数以及出现的位置
文件存在与程序同一目录下,文件名为test.txt
#include <stdio.h>
#include <string.h>
void change(char *a)
{
while(*a!='\0')
{
if(*a>='A'&&*a<='Z')
*a+=32;
a++;
}
}
int main(void)
{
FILE *fp;
char s[10],read[10],*p=read,ch;
int n,sum=0,sn=0,flag=0;
if((fp=fopen("test.txt","rt"))==NULL)
{
printf("\n打开文件失败");
getchar();
exit(1);
}
printf("请输入要查找的单词:\n");
gets(s);
change(s);
n=strlen(s);
ch=fgetc(fp);
if(flag==0) sn++;
while(feof(fp)!=1)
{
while(ch!=' '&&ch!=','&&ch!='.'&&ch!='!'&&ch!='?'&&ch!=':'&&ch!='"'&&ch!=';')
{
*p=ch;
p++;
ch=fgetc(fp);
if(flag==0) sn++;
}
*p='\0';
change(read);
if(strcmp(s,read)==0)
{
sum++;
flag=1;
}
ch=fgetc(fp);
if(flag==0) sn++;
p=read;
printf("%s\n",read);
}
if(flag==0) sn=n;
printf("该文章中单词%s出现的次数为%d,第一个%s出现的位置为:%d",s,sum,s,sn-n);
fclose(fp);
return 0;
}
Ⅹ 怎么统计一篇英文文章中各个单词的出现频率
有网站可以统计,免费的。
你网络一下单词词频统计。