英語文章單詞出現次數
Ⅰ 有沒有能統計一篇英文文章中所有單詞出現次數的軟體
對不起,復我來晚啦。
我用過一制個軟體。
功能如下: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;
}
Ⅹ 怎麼統計一篇英文文章中各個單詞的出現頻率
有網站可以統計,免費的。
你網路一下單詞詞頻統計。