Beispiel #1
0
int main(int argc, char** argv) {

  if (HasOpt(argv, argv + argc, "-h")) {
    printf("HalideProf [-f funcname] [-sort c|t|to] [-top N] [-overhead=0|1] < profiledata\n");
    return 0;
  }

  std::string func_name_filter = GetOpt(argv, argv + argc, "-f");

  bool (*sort_by_func)(const OpInfo& a, const OpInfo& b);
  std::string sort_by = GetOpt(argv, argv + argc, "-sort");
  if (sort_by.empty() || sort_by == "to") {
    sort_by_func = by_ticks_only;
  } else if (sort_by == "t") {
    sort_by_func = by_ticks;
  } else if (sort_by == "c") {
    sort_by_func = by_count;
  } else {
    std::cerr << "Unknown value for -sort: " << sort_by << "\n";
    exit(-1);
  }

  int32_t top_n = 10;
  std::string top_n_str = GetOpt(argv, argv + argc, "-top");
  if (!top_n_str.empty()) {
    std::istringstream(top_n_str) >> top_n;
  }
Beispiel #2
0
void CClause::AssignSynVariantsGrammems(CMorphVariant&  synVariant, const CFormatCaller& FormatCaller)
{
	assert(synVariant.m_SynUnits.size() == FormatCaller.sent.size());
	const CAgramtab& piGramTab = * (GetOpt()->GetGramTab());

	
	for(int UnitNo = 0; UnitNo < synVariant.m_SynUnits.size() ; UnitNo++ )
	{	
		const CSynPlmLine& W = FormatCaller.sent[UnitNo];
		
		if( W.m_UnitType != EWord )
			continue;

		if( W.has_unk_gramcodes() )
			continue;

		if	(		W.HasFlag(fl_in_oborot)
				&&	!(W.HasFlag(fl_oborot1) && W.HasFlag(fl_oborot2))
			)
			continue;

        synVariant.m_SynUnits[UnitNo].ModifyGrammems ( W.GetGrammems(),W.GetPoses());
		synVariant.m_SynUnits[UnitNo].m_GramCodes = string(W.m_gramcodes);
		
	}


	
	//	берем все простые  предлоги омонима, на которых была построена предложная 
	//	группа. Если предложная группа была  построена, тогда m_FoundPrepDependCases
	//	содержит  падежи, которые  были найдены у зависимого от предлого слова.
	
	for(int UnitNo = 0 ; UnitNo < FormatCaller.sent.size() ; UnitNo++ )
	{
		synVariant.m_SynUnits[UnitNo].m_FoundPrepDependCases = FormatCaller.sent[UnitNo].m_FoundPrepDependCases; 

		if (		FormatCaller.sent[UnitNo].get_simple_preps() 
				&&	!FormatCaller.sent[UnitNo].get_simple_preps()->empty()
			) 
		{
			synVariant.m_SynUnits[UnitNo].m_SimplePrepNos.clear();

			const vector<int>& preps = *(FormatCaller.sent[UnitNo].get_simple_preps());
			
			for(int k = 0 ; k < preps.size() ; k++ ) 
				if (FormatCaller.sent[UnitNo].m_FoundPrepDependCases == 0)
					synVariant.m_SynUnits[UnitNo].m_SimplePrepNos.push_back(preps[k]);			
				else
					if( GetOpt()->m_pOborDic->m_Entries[preps[k]].m_DependCases & FormatCaller.sent[UnitNo].m_FoundPrepDependCases )
						synVariant.m_SynUnits[UnitNo].m_SimplePrepNos.push_back(preps[k]);			
		}
	}
}
    // Synchronous
    TInt poll(TUint &bitsRef) {
	TInt bits;
	TInt err = GetOpt(KSOSelectPoll, KSOLSocket, bits);
	if (err == KErrNone) {
	    bitsRef = (TUint)bits;
	    return err;
	}
	TInt poll_err;
	TInt err2 = GetOpt(KSOSelectLastError, KSOLSocket, poll_err);
	if (err2 == KErrNone) {
	    return poll_err;
	}
	return err;
    }
Beispiel #4
0
void main( int argc, char *argv[] )
{
    int         ch;
    int         i;

    argv = ExpandEnv( &argc, argv );

    while( 1 ) {
        ch = GetOpt( &argc, argv, "n", usageMsg );
        if( ch == -1 ) {
            break;
        }
        switch( ch ) {
        case 'n':
            includeNetwork = 1;
            break;
        }
    }

    printf( "drive  KBytes        used       avail   capacity\n" );
    if( argc > 1 ) {
        includeNetwork = 1;
        for( i = 1; i < argc; i++ ) {
            doDF( argv[i][0] );
        }
    } else {
        for( i = 'C'; i <= 'Z'; i++ ) {
            doDF( i );
        }
    }

    exit( 0 );

} /* main */
Beispiel #5
0
bool CRusSentence::IsAdjDeclination (const CSynHomonym& H) const
{
	if (!H.IsMorphNoun()) return false;
	if (H.m_strLemma.length() < 3)  return false;
	if (H.m_lPradigmID == -1) return false;
	string suffix = H.m_strLemma.substr(H.m_strLemma.length()-2);
	bool bMasc = (suffix == "»…") ||  (suffix == "џ…");
	bool bFem = (suffix == "јя") ||  (suffix == "яя");
	if (!bMasc && !bFem) return false;

	CFormInfo Info;
	GetOpt()->GetLemmatizer()->CreateParadigmFromID(H.m_lPradigmID, Info);
	for (long k=0; k < Info.GetCount(); k++)
	{
		string Ancode = Info.GetAncode(k);
		QWORD  g = GetRusGramTab()->GetAllGrammems(Ancode.c_str());
		if (  g & _QM(rSingular) )
			if ( g & _QM(rGenitiv) )
			{
				string Form = Info.GetWordForm(k);
				int l = Form.length();
				if (l < 3) return false;
				if (bMasc)
					return		(Form.substr(l-3) == "≈√ќ")
							||	(Form.substr(l-3) == "ќ√ќ");
				else
					return		(Form.substr(l-2) == "ќ…")
							||	(Form.substr(l-2) == "≈…");
			};
	};
	return false;		
};
Beispiel #6
0
bool	Options::SwitchOpt	(int Option)
{
	if (Option < OPTION_COUNT)
		return SetOpt(Option, !GetOpt(Option));

	return false;
}
Beispiel #7
0
bool CGerFormatCaller::format_for_verb_modif(CGroup& G)
{
    const CGroup& G1 = get_maximal_group(G.m_iFirstWord);
    if (G1.m_iLastWord+1 >= sent.size()) return false;
    const CGroup& G2 = get_maximal_group(G1.m_iLastWord+1);

    const CSynPlmLine& ww = sent[get_main_word(G.m_iFirstWord)];

    // to prohibit "wann machen" as a group
    if( GetOpt()->m_pOborDic->FindSubConj (ww.m_lemma ) != -1 )
        return false;

    // to prohibit "sehr machen"  as a group
    if( CanBeAdjModifier (ww ))
        return false;


    int i = get_main_word(G1.m_iFirstWord);
    if  (		!is_morph_adv(sent[i])
                &&	!	(		(sent[i].GetPoses() & (1<<gADJ))
                                &&	(sent[i].has_grammem(gPredikBenutz))
                     )
        ) return false;
    int j = get_main_word(G2.m_iFirstWord);
    if    (!is_verb_form(sent[j]) || sent[j].m_UnitType == EClause)  return false;
    G.m_iLastWord = G2.m_iLastWord;
    G.m_GroupType = gVERB_MODIF;
    create_syn_rel(G, j, i,  gVERB_MODIF);
    G.m_MainGroup =  G2;
    return true;
}
Beispiel #8
0
int CClause::FindClauseSubordConj(const char* ConjStr)  const
{
	const COborDic* D = GetOpt()->m_pOborDic;
	for(int i = 0; i < m_vectorConjs.size() ; i++ )
	{
		const SConjIndex& conj = m_vectorConjs[i];

		if	(		( conj.m_FromWhere == FROM_SUB_CONJ )
				&&	(		!ConjStr
						||	!strcmp( D->GetSubConjs()[m_vectorConjs[i].m_index].c_str(), ConjStr ) 
					)
			)
			return i;


		if	(conj.m_FromWhere == FROM_OBOR_DIC)
		{
			const COborotForSyntax& O =  D->m_Entries[m_vectorConjs[i].m_index];
			if (	(O.m_ConjType == sub_conj) 
				&&	(		!ConjStr
						||	!strcmp( O.m_OborotEntryStr.c_str(), ConjStr) 
					)
			)
			return i;
		};
	}

	return -1;
}
Beispiel #9
0
void CClause::BuildSynVariants()
{
	m_SynVariants.clear();
	
	vector<CBuildingUnit> BuildingUnits;
	GetBuildingUnits(BuildingUnits);
	
	CMorphVariant synVariant(GetOpt()->GetGramTab());
    size_t EstimCount = 1;
    for (size_t i =0; i < BuildingUnits.size(); i++)
    {
        EstimCount *= BuildingUnits[i].m_HomonymsCount;
        if (EstimCount > MorphVarMaxCount)
            break;
    }
    if (EstimCount > MorphVarMaxCount)
        AddSynVariantsWithUnusedHomonyms(*this, BuildingUnits );
    else
    	BuildSynVariantsRecursive(BuildingUnits.begin(), synVariant);
	/*
    BuildSynVariantsRecursive(BuildingUnits.begin(), synVariant);
   	if (m_SynVariants.size() >= 200)
		AddSynVariantsWithUnusedHomonyms(*this, BuildingUnits );
*/
		

	for(SVI  pVar  = m_SynVariants.begin() ; pVar != m_SynVariants.end(); pVar++ )
	{
		CMorphVariant& synVariant = *pVar;
		m_pSent->ChooseClauseType(m_vectorTypes, synVariant);
	};

	rml_TRACE("BuildSynVariants found %i variants for %s\n",m_SynVariants.size(), GetTraceStr().c_str() );
}
Beispiel #10
0
bool	CClause::HasUnambiguousStrongRootWithoutWeakHomonyms() const
{
	try {
		for (int i = 0; i < m_vectorTypes.size(); i++)
		{
			// Пустыхи и копулы пропускаем
			if (m_vectorTypes[i].m_Root.IsEmpty()) continue;;
			const CSynWord& word  = GetWords()[m_vectorTypes[i].m_Root.m_WordNo];

			int j = 0;

			for (; j < word.GetHomonymsCount(); j++)
				if (! GetOpt()->GetGramTab()->IsStrongClauseRoot(word.GetSynHomonym(j).m_iPoses ))
					break;

			if (j == word.GetHomonymsCount())	return true;
		};
	}
	catch (...)
	{
		m_pSent->OutputErrorString("HasUnambiguousStrongRootWithoutWeakHomonyms has an exception");

	};

	return false;
};
Beispiel #11
0
void main( int argc, char **argv ) {

    int         ch;
    long        offs[2];
    int         i;
    int         fh[2];

    argv = ExpandEnv( &argc, argv );

    for(;;) {
        ch = GetOpt( &argc, argv, "lsx", usageTxt );
        if( ch == -1 ) break;
        switch( ch ) {
        case 'l':
            flagKeepGoing = 1;
            break;
        case 's':
            flagSayNothing = 1;
            break;
        case 'x':
            flagSayItInHex = 1;
            break;
        }
    }
    if( argc < 3 || argc > 5 ) {
        Quit( usageTxt, "invalid number of arguments\n" );
    }
    offs[0] = offs[1] = 0;
    if( argc > 3 ) {
        offs[0] = strtol( argv[3], NULL, 0 );
        if( argc > 4 ) {
            offs[1] = strtol( argv[4], NULL, 0 );
        }
    }
    ++argv;             // don't care about argv[0]
    for( i = 0; i < 2; ++i ) {
        if( argv[i][0] == '-' && argv[i][1] == 0 ) {
            if( i == 1 && fh[0] == STDIN_FILENO ) {
                Die( "cmp: only one argument can be stdin\n" );
            }
            fh[i] = STDIN_FILENO;
            argv[i] = "(stdin)";
        } else {
            fh[i] = open( argv[i], O_RDONLY | O_BINARY );
            if( fh[i] == -1 ) {
                Die( "unable to open %s: %s\n", argv[i], strerror( errno ) );
            }
        }
        if( offs[i] ) {
            if( lseek( fh[i], offs[i], SEEK_SET ) == -1L ) {
                Die( "error seeking to %s in %s: %s\n", argv[i+2], argv[i],
                            strerror( errno ) );
            }
        }
    }

    exit( cmp( fh, argv, offs ) );
}
Beispiel #12
0
bool GetOpt(int &argc, LPTSTR *&argv, LPTSTR flag, long *n)
{
	int i;
	if (GetOpt(argc, argv, flag, &i))
	{
		*n = (long)i;
		return true;
	}
	return false;
}
Beispiel #13
0
/* start of mainline */
int main( int argc, char *argv[] )
{
    int i;
    int ch;
    DIR *d;

    /* process options */
    while( ( ch = GetOpt( &argc, argv, "firRsvX", usageMsg ) ) != -1 ) {
        switch( ch ) {
        case 'f': fflag  = TRUE;  iflag = FALSE; break;
        case 'i': iflag  = TRUE;  fflag = FALSE; break;
        case 'R':
        case 'r': rflag  = TRUE;  break;
        case 's': sflag  = TRUE;  break;
        case 'v': sflag  = FALSE; break;
        case 'X': rxflag = TRUE;  break;
        }
    }
    if( argc < 2 )
        Quit( usageMsg, "No filename/directory specified\n" );

    StartPrint();

    /* process -r option */
    if( rflag ) {
        for( i = 1; i < argc; i++ ) {
            if( strcmp( argv[i], rxflag ? "*" : "*.*" ) == 0 )
                RecursiveRM( "." );
            else {
                d = FileNameWild( argv[i], rxflag ) ? NULL : opendir( argv[i] );
                if( d != NULL ) {
                    if( !( d->d_attr & _A_SUBDIR ) ) {
                        closedir( d );
                        if( fflag )
                            DoRM( argv[i] );
                        else
                            PrintALineThenDrop( "%s is not a directory.", argv[i] );
                    } else {
                        closedir( d );
                        RecursiveRM( argv[i] );
                    }
                } else if( !fflag ) {
                    PrintALineThenDrop( "Directory %s not found.", argv[i] );
                    error_occured = 1;
                }
            }
        }
    } else {
        /* run through all specified files */
        for( i = 1; i < argc; i++ )
            DoRM( argv[i] );
    }
    DropALine();
    return( error_occured );
}
Beispiel #14
0
string  CClause::GetTraceStr() const
{
	string T;
	for (int i = 0; i < m_vectorTypes.size(); i++)
	{
		T += GetOpt()->GetGramTab()->GetClauseNameByType(m_vectorTypes[i].m_Type);
		if (i+1 < m_vectorTypes.size())
			T+= "|";
	};
	if (T == "") T = "no_type";
	return Format("%s(%i %i) ", T.c_str(), m_iFirstWord, m_iLastWord);
};
Beispiel #15
0
bool CClause::HasOnlyOneSimConjFromOborDic() const
{
	int c = 0;
	for(int i = 0 ; i < m_vectorConjs.size() ; i++ )
	{
		const SConjIndex& conj = m_vectorConjs[i];
		if(		(conj.m_FromWhere == FROM_OBOR_DIC)
			&&	(GetOpt()->m_pOborDic->m_Entries[conj.m_index].m_ConjType != sub_conj) )
			c++;
	}
	return (c == 1);
}
Beispiel #16
0
STDMETHODIMP CCOMClause::get_Description(BSTR *pVal)
{
	try
	{

		string S = " ";
		for(int i = 0 ; i < m_pClause->m_vectorConjs.size(); i++)		
		{
			int iConjIndex = m_pClause->m_vectorConjs[i].m_index;

			switch(m_pClause->m_vectorConjs[i].m_FromWhere)
			{
			case FROM_OBOR_DIC:
				{
					S += "\"";
					S += GetOpt()->m_pOborDic->m_Entries[iConjIndex].m_OborotEntryStr;
					S += "\"";
					break;
				}
			case FROM_SUB_CONJ:
				{
					S += GetOpt()->m_pOborDic->GetSubConjs()[iConjIndex];
					break;
				}
			
			}
			S += " ";
		}	
		if (m_pClause->IsRelative())
			S = "Relative " + S;
		*pVal = _bstr_t(S.c_str()).copy();
	}
	catch(...)
	{
		return E_FAIL;
	}

	return S_OK;
}
Beispiel #17
0
int  CClause::GetMainWordOfTheClauseForThisVariant(const CMorphVariant& M, const CClauseRelation& R ) const
{
	int MainWord = -1;

	EClauseType t =  (M.m_ClauseTypeNo == -1) ? UnknownSyntaxElement : m_vectorTypes[M.m_ClauseTypeNo].m_Type;
	if	(		R.m_ClauseTypes.empty()
			||	( find(R.m_ClauseTypes.begin(), R.m_ClauseTypes.end(), t ) != R.m_ClauseTypes.end())
		)
		MainWord = (M.m_ClauseTypeNo == -1) ? -1 : m_vectorTypes[M.m_ClauseTypeNo].m_Root.m_WordNo ;


	if (MainWord == -1 )
		if ( (GetOpt()->m_Language == morphRussian) && HasType( GetOpt()->m_RusParenthesis ))
			// find the first word which starts an oborot
			for ( int i = m_iFirstWord; i <= m_iLastWord; i++ )
				if ( GetWords()[i].HasOborot1() ) 
				{
					MainWord = i;
				}

	return MainWord;
};
Beispiel #18
0
STDMETHODIMP CCOMClause::get_ConjStr(int iNum, BSTR *pVal)
{
	try
	{
		char strBuf[256];
		strcpy(strBuf," ");
		if( (iNum < 0) || (iNum >= m_pClause->m_vectorConjs.size()))
			return E_FAIL;

		int iConj;
		iConj = m_pClause->m_vectorConjs[iNum].m_index;

		switch(m_pClause->m_vectorConjs[iNum].m_FromWhere)
		{
		case FROM_OBOR_DIC:
			{
				strcpy(strBuf, GetOpt()->m_pOborDic->m_Entries[iConj].m_OborotEntryStr.c_str());				
				break;
			}
		case FROM_SUB_CONJ:
			{
				strcpy(strBuf,GetOpt()->m_pOborDic->GetSubConjs()[iConj].c_str());
				break;
			}
		
		}
			
		*pVal = _bstr_t(strBuf).copy();

	}
	catch(...)
	{
		return E_FAIL;
	}

	return S_OK;

}
void ExampleFilteredSimDataAnalysis::InitAnalysis()
{
   // INITIALISATION PERFORMED AT BEGINNING OF ANALYSIS
   // Here you define:
   //   - global variables
   //   - histograms
   //   - trees
   //
   // NB: no access to multidetector array or reaction
   //     kinematics yet: see InitRun()

   // DEFINITION OF GLOBAL VARIABLES FOR ANALYSIS

   // charged particle multiplicity
   KVVarGlob* v = AddGV("KVVGSum", "Mcha");
   v->SetOption("mode", "mult");
   v->SetSelection(KVParticleCondition("_NUC_->GetZ()>0"));

   AddGV("KVZtot", "ZTOT");//total charge
   AddGV("KVZVtot", "ZVTOT");//total pseudo-momentum
   ZMAX = (KVZmax*)AddGV("KVZmax", "ZMAX");//fragments sorted by Z

   // DEFINITION OF TREE USED TO STORE RESULTS
   CreateTreeFile();

   TTree* t = new TTree("data", GetOpt("SimulationInfos"));

   // add a branch to tree for each defined global variable
   GetGVList()->MakeBranches(t);

   // add branches to be filled by user
   t->Branch("mult", &mult);
   t->Branch("Z", Z, "Z[mult]/I");
   t->Branch("A", A, "A[mult]/I");
   t->Branch("array", array, "array[mult]/I");
   t->Branch("idcode", idcode, "idcode[mult]/I");
   t->Branch("ecode", ecode, "ecode[mult]/I");
   t->Branch("Ameasured", Ameasured, "Ameasured[mult]/I");
   t->Branch("Vper", Vper, "Vper[mult]/D");
   t->Branch("Vpar", Vpar, "Vpar[mult]/D");
   t->Branch("ELab", ELab, "ELab[mult]/D");
   t->Branch("ThetaLab", ThetaLab, "ThetaLab[mult]/D");
   t->Branch("PhiLab", PhiLab, "PhiLab[mult]/D");

   AddTree(t);

   // check if we can access the original simulated events before filtering
   // (activated when selecting both filtered & simulated files in kaliveda-sim GUI)
   link_to_unfiltered_simulation = IsOptGiven("AuxFiles");
}
Beispiel #20
0
    ///////////////////////////////////////////////////////////////////////
    // Function: GetNoDelayOpt
    //
    //   Author: $author$
    //     Date: 5/15/2009
    ///////////////////////////////////////////////////////////////////////
    virtual int GetNoDelayOpt() const 
    {
        int on;
        SOCKET_OPT_LENGTH length;
        EvError error;

        length = ((SOCKET_OPT_LENGTH)sizeof(on));

        if ((error = GetOpt
            (IPPROTO_TCP, TCP_NODELAY, &on, length)))
            return -error;

        on = OUT_SOCKET_NODELAY_ON(on);
        return on;
    }
Beispiel #21
0
const CGroup* CClause::GetLastFirmHost(int iWord, CSVI pSynVar) const
{
	const CMorphVariant& pVar = *pSynVar;
	for(int i = pVar.m_vectorGroups.GetGroups().size() - 1 ; i >= 0 ; i--)
	{		
		const CGroup& group = pVar.m_vectorGroups.GetGroups()[i];
		if(		(group.m_iFirstWord <= iWord) 
			&&	(group.m_iLastWord >= iWord) 
			&&	GetOpt()->is_firm_group(group.m_GroupType)
		  )
		return &group;
	}

	return NULL;		

}
Beispiel #22
0
    ///////////////////////////////////////////////////////////////////////
    // Function: GetDontLingerOpt
    //
    //   Author: $author$
    //     Date: 5/15/2009
    ///////////////////////////////////////////////////////////////////////
    virtual int GetDontLingerOpt() const 
    {
        SOCKET_LINGER linger;
        SOCKET_OPT_LENGTH length;
        EvError error;
        int on;

        length = ((SOCKET_OPT_LENGTH)sizeof(linger));

        if ((error = GetOpt
            (SOL_SOCKET, SO_LINGER, &linger, length)))
            return -error;

        on = GET_SOCKET_DONT_LINGER_ON(linger);
        return on;
    }
Beispiel #23
0
void main( int argc, char **argv )
{
    unsigned    secs, mins, hours;
    char       *p, *op;

    argv = ExpandEnv( &argc, argv );

    GetOpt( &argc, argv, "", usageMsg );

    if( argc != 2 ) {
        Die( "%s\n", usageMsg[0] );
    } else {
        hours = 0;
        mins  = 0;
        secs  = 0;

        op = argv[1];
        for( p = argv[1]; *p != NULL; p++ ) {
            switch( *p ) {
            case 'h':
                *p = 0;
                hours += atoi( op );
                op = p + 1;
                break;
            case 'm':
                *p = 0;
                mins += atoi( op );
                op = p + 1;
                break;
            case 's':
                *p = 0;
                secs += atoi( op );
                op = p + 1;
                break;
            default:
                if( !isdigit( *p ) ) {
                    Die( "sleep: invalid time specified\n" );
                }
            }
        }
        secs += atoi( op ) + 60*mins + 3600*hours;
        sleep( secs );
    }
}
Beispiel #24
0
/*
 проверяет согласование, когда сказуемое  - личная форма глагола
 SubjGroupFirstWordNo - первое слово субъектной группы
 SubjWordNo - главное слово субъектной группы (результат)
*/
bool CRusSentence::check_verb_subj_coordination(const CMorphVariant& synVariant, int predk, int SubjGroupFirstWordNo, int& SubjWordNo) const
{
	const CSynUnit& PredUnit = synVariant.m_SynUnits[predk];
	const CSynHomonym& PredHom = m_Words[PredUnit.m_SentPeriod.m_iFirstWord].m_Homonyms[PredUnit.m_iHomonymNum];

    int gr_num = synVariant.m_vectorGroups.get_maximal_group_no(SubjGroupFirstWordNo);
    int main_word = (gr_num == -1) ? SubjGroupFirstWordNo : synVariant.m_vectorGroups.GetGroups()[gr_num].m_MainWordNo;
	const CSynUnit& SubjUnit = synVariant.m_SynUnits[main_word];
	const CSynHomonym& SubjHom = m_Words[SubjUnit.m_SentPeriod.m_iFirstWord].m_Homonyms[SubjUnit.m_iHomonymNum];


	if(    GetOpt()->GetGramTab()->GleicheSubjectPredicate(SubjHom.m_GramCodes.c_str(), PredUnit.m_GramCodes.c_str() )	
		|| gleiche_subj_pred_for_numerals_as_nouns(synVariant, predk, main_word ) 
	  )
	{
		SubjWordNo = main_word;
		return true;
	}
	else
	{
		if( gr_num != -1 )
			if(	!(		(PredHom.m_iGrammems & _QM(rImperative) )
					||	(PredHom.m_iGrammems  & ( _QM(rFirstPerson) | _QM(rSecondPerson)))
				 )
			  )
			{
					if( GleicheSubjPredForNumeralAndSimilar(synVariant,  predk, gr_num) )
					{
						SubjWordNo = main_word;				
						return true;
					}
					//nim : "все четыре мальчика ушли"
					int MinimalGroupNo = synVariant.m_vectorGroups.get_minimal_group(main_word);

					if( GleicheSubjPredForNumeralAndSimilar(synVariant, predk,  MinimalGroupNo) )
					{
						SubjWordNo = main_word;				
						return true;

					}								
			}
	}
	return false;
};
Beispiel #25
0
/*
 * start of mainline
 */
int main( int argc, char *argv[] )
{
    int i,ch;

#ifndef __QNX__
    maxwidth = GetConsoleWidth();
#else
    maxwidth = LINE_WIDTH;              /* for now */
#endif

    maxwidth /= COLUMN_WIDTH;

    for( ;; ) {
        ch = GetOpt( &argc, argv, "dfr", usageMsg );
        if( ch == -1 ) {
            break;
        }
        switch( ch ) {
        case 'd':
            directories_only = 1;
            break;
        case 'f':
            files_only = 1;
            break;
        case 'r':
            separate_read_only = 1;
            break;
        }
    }

    if( directories_only && files_only ) {
        directories_only = files_only = 0;
    }
    if( argc == 1 ) {
        DoLC( "." );
    } else {
        for( i=1;i<argc;i++ ) {
            printf("%s:\n",argv[i]);
            DoLC( argv[i] );
        }
    }
    return( 0 );
} /* main */
int main (int argc, char* argv[])
{
    int NumSeq=1, KLet=2, Mode=0;
    string buffer;
    if (ComOptExists(argv,argv+argc,"-h"))
    {
        cout << "Random sequence generators\n\nThis program takes an input sequence via stdin and generates a desired number of new sequences containing the same set of characters in a randomized order."
             << "\n\nProgram usage: " << argv[0] << " [OPTIONS]\n"
             << "\nThree modes of operation are available:\n\t(1) generation of a random sequence by randomly choosing characters depending on their respective frequency in the input"
             << "\n\t(2) iterate through the input sequence and exchange each character with a following, randomly chosen one"
             << "\n\t(3) sequence shuffling preserving the frequencies of k-lets, subsequences of length k"
             << "\n\nOPTIONS:\n\t-h: shows this page\n\t-m: mode of operation (1-3)\n\t-k: k-let length (default: 2)\n\t-n: number of sequences to be generated (default: 1)" << endl;
        return 0;
    }
//   determine mode of operation
    if (ComOptExists(argv,argv+argc,"-m"))
    {
	buffer = GetOpt(argv,argv+argc,"-m");
	stringstream str(buffer);
	str >> Mode;
    }
Beispiel #27
0
//  проверяет, что вершина клаузы iClauseNum1 и вершина iClauseNum2 согласовани  как личные глагольные формы 
bool CRusSentence::CheckCoordinarionBetweenClauseRoots(GrammemCompare CompareFunc, int iClauseNum1, int iClauseNum2 ) const
{
	
	const CClause& C1 = GetClause(iClauseNum1);
	const CClause& C2 = GetClause(iClauseNum2);


	for (int i = 0; i < C1.m_vectorTypes.size(); i++)
		for (int k = 0; k < C2.m_vectorTypes.size(); k++)
			if (		!C1.m_vectorTypes[i].m_Root.IsEmpty()
					&&	!C2.m_vectorTypes[k].m_Root.IsEmpty()
				)
			{
				const CSynHomonym& H1 = m_Words[C1.m_vectorTypes[i].m_Root.m_WordNo].m_Homonyms[C1.m_vectorTypes[i].m_Root.m_HomonymNo];
				const CSynHomonym& H2 = m_Words[C2.m_vectorTypes[k].m_Root.m_WordNo].m_Homonyms[C2.m_vectorTypes[k].m_Root.m_HomonymNo];
                if (GetOpt()->GetGramTab()->Gleiche(CompareFunc, H1.m_GramCodes.c_str(), H2.m_GramCodes.c_str()))
                    return true;
			};
	return false;

};
Beispiel #28
0
//top main
int main(int argc, char **argv){
	DB(fprintf(stderr,"IN main()\n"));
	//argment analysis
	OPT serv_op;
	InitOpt(&serv_op);
	GetOpt(argc-1,argv+1,&serv_op);
	DB(fprintf(stderr,"n_file :%s:\n",serv_op.n_file));
	DB(fprintf(stderr,"data file :%s:\n",serv_op.db_file));
	DB(fprintf(stderr,"default service :%s:\n",SERVICE_NAME));
	DB(fprintf(stderr,"sub port :%d:\n",serv_op.port));

	//init global vars
	InitBuf(&RecvBuf,SHORT_BUF_SIZE);
	InitBuf(&CommBuf,LONG_BUF_SIZE);

	//init socket
	if(InitSocket(SERVICE_NAME,serv_op.port) == -1){
		return(-1);
	}

	//init signal - bind()
	InitSignal();

	//listen
	listen(Soc,SOMAXCONN);

	//data read
	read_db_n(serv_op);
        read_db_term(serv_op);

	//mainloop - data read, accept(), fork(), ChildLoop()
	MainLoop(serv_op);

	//close socket
	CloseSocket();

	DB(fprintf(stderr,"OUT main()\n"));
	return(0);
}
Beispiel #29
0
void GetOptions (void)
{
    char *endch;
    char opt;
    
//  StrLCpy (kargstr, (char*)mbi->cmdline, 512);
    endch = Tokenize (kargstr);
    kargc = InitKargvArray (kargstr, endch, kargv);

    while ((opt = GetOpt(kargv, kargc, "D")) != -1)
    {
        switch (opt)
        {
            case 'D':       /* -D : Enable Debugging Output */
                __debug_enabled = TRUE;
                break;

            default:
                break;
        }
    }
}
Beispiel #30
0
void CRusSentence::InitHomonymMorphInfo (CSynHomonym& H)
{

    H.InitAncodePattern( );
	
	//сравнение со словниками
	H.m_bMonth = GetOpt()->GetGramTab()->is_month(H.m_strLemma.c_str());
	H.m_bAdvAdj = H.CompareWithPredefinedWords(*(GetOpt()->AdvAdj));
	H.m_bCanSynDependOnAdj = H.CompareWithPredefinedWords(*(GetOpt()->SynDependOnAdj));
	H.m_bCanSynDependOnAdv = H.CompareWithPredefinedWords(*(GetOpt()->SynDependOnAdv));
	H.m_bCanSubdueInfinitive = H.CompareWithPredefinedWords(*(GetOpt()->VerbsThatCanSubdueInfinitive));
	H.m_bCanSubdueInstr = H.CompareWithPredefinedWords(*(GetOpt()->m_pVerbsWithInstrObj));
	H.m_bNounHasAdjectiveDeclination = IsAdjDeclination(H);

	
	
};