示例#1
0
文件: rmpunc.c 项目: mahlky01/rmpunc2
int main(int argc, char* argv[]) {
  char c;

/*  c = getchar();
  
  while (c != EOF) {
    if(!ispunc(c)){
      printf("%c",c);
      c = getchar();
    }
  }
works the same way as:
*/
  
  while((c=getchar()) != EOF) {
    if (!ispunc(c))
      printf("%c",c);
  }

  return 0;
 
}
示例#2
0
文件: sentence.c 项目: JoeHill/julian
void convert_sentence(sentence_type *sentence)
{
  int i;
  int n;
  int w,t;
  int lflag;

  n = 0;

  for(i=0;i<PMAXWORDS;i++)
    sentence->commaats[i]=0;

  for(i=0;i<sentence->nws;i++)
    {
      if(!ispunc(sentence->tags[i]))
	{
	  w = find_word(sentence->words[i],&wordlex);
	  if(w==-1)
	    sentence->wordnos[n] = GUNKNOWN;
	  else
	    sentence->wordnos[n] = w;

	  sentence->wordpos[n] = i;

	  t = find_word(sentence->tags[i],&nt_lex);

	  if(!(t>=0))
	    {
	      printf("TAG %s not found\n",sentence->tags[i]);
	      assert(0);
	    }
	  
	  sentence->tagnos[n] = t;
	  n++;
	}
      else
	{
	  if(iscomma(sentence->tags[i],sentence->words[i])&&n>0)
	    {
	      sentence->commaats[n-1] =1;

	      w = find_word(sentence->words[i],&wordlex);
	      if(w==-1)
		sentence->commawords[n-1] = GUNKNOWN;
	      else
		sentence->commawords[n-1] = w;
	      
	      t = find_word(sentence->tags[i],&nt_lex);
	      
	      if(!(t>=0))
		{
		  printf("TAG %s not found\n",sentence->tags[i]);
		  assert(0);
		}	      
	      sentence->commatags[n-1] = t;
	    }
	}
    }
  sentence->nws_np = n;
  sentence->commaats[n-1] = 0;
  
  lflag=0;
  for(i=0;i<sentence->nws_np+1;i++)
    {
      if(sentence->tagnos[i]==NT_LRB) lflag=1;
      if(sentence->tagnos[i]==NT_RRB) lflag=0;
      if(lflag==0)
	sentence->commaats2[i]=sentence->commaats[i];
      else
	sentence->commaats2[i]=0;
    }

}