SNAP Library , Developer Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
00001 00002 00003 class TGUtil { 00004 public: 00005 static void GetCdf(const TIntPrV& PdfV, TIntPrV& CdfV); 00006 static void GetCdf(const TFltPrV& PdfV, TFltPrV& CdfV); 00007 static void GetCdf(const TIntFltKdV& PdfV, TIntFltKdV& CdfV); 00008 static TIntPrV GetCdf(const TIntPrV& PdfV); 00009 static TFltPrV GetCdf(const TFltPrV& PdfV); 00010 00011 static void GetCCdf(const TIntPrV& PdfV, TIntPrV& CCdfV); 00012 static void GetCCdf(const TFltPrV& PdfV, TFltPrV& CCdfV); 00013 static void GetCCdf(const TIntFltKdV& PdfV, TIntFltKdV& CCdfV); 00014 static TIntPrV GetCCdf(const TIntPrV& PdfV); 00015 static TFltPrV GetCCdf(const TFltPrV& PdfV); 00016 00017 static void GetPdf(const TIntPrV& CdfV, TIntPrV& PdfV); 00018 static void GetPdf(const TFltPrV& CdfV, TFltPrV& PdfV); 00019 static void GetPdf(const TIntFltKdV& CdfV, TIntFltKdV& PdfV); 00020 00021 static void Normalize(TFltPrV& PdfV); 00022 static void Normalize(TIntFltKdV& PdfV); 00023 00024 static void MakeExpBins(const TFltPrV& XYValV, TFltPrV& ExpXYValV, 00025 const double& BinFactor = 2, const double& MinYVal = 1); 00026 static void MakeExpBins(const TFltKdV& XYValV, TFltKdV& ExpXYValV, 00027 const double& BinFactor = 2, const double& MinYVal = 1); 00028 static void MakeExpBins(const TFltV& YValV, TFltV& ExpYValV, const double& BinFactor = 1.01); 00029 static void MakeExpBins(const TIntV& YValV, TIntV& ExpYValV, const double& BinFactor = 1.01); 00030 }; 00031 00034 class TStrUtil { 00035 public: 00036 static TChA& GetXmlTagVal(TXmlLx& XmlLx, const TChA& TagNm); 00037 static void GetXmlTagNmVal(TXmlLx& XmlLx, TChA& TagNm, TChA& TagVal); 00038 static bool GetXmlTagNmVal2(TXmlLx& XmlLx, TChA& TagNm, TChA& TagVal, const bool& TakeTagNms); 00039 static TChA GetDomNm(const TChA& UrlChA); // www.cs.cmu.edu 00040 static TChA GetDomNm2(const TChA& UrlChA); // also strip starting www. 00041 static TChA GetWebsiteNm(const TChA& UrlChA); // get website (GetDomNm2 or blog url) 00042 static bool GetNormalizedUrl(const TChA& UrlIn, const TChA& BaseUrl, TChA& UrlOut); 00043 static bool StripEnd(const TChA& Str, const TChA& SearchStr, TChA& NewStr); 00044 00045 static TChA GetShorStr(const TChA& LongStr, const int MaxLen=50); 00046 static TChA GetCleanStr(const TChA& ChA); 00047 static TChA GetCleanWrdStr(const TChA& ChA); 00048 static int CountWords(const char* CStr); 00049 static int CountWords(const TChA& ChA); 00050 static int CountWords(const TChA& ChA, const TStrHash<TInt>& StopWordH); 00051 static int SplitWords(TChA& ChA, TVec<char *>& WrdV, const bool& SplitOnWs=true); 00052 static int SplitOnCh(TChA& ChA, TVec<char *>& WrdV, const char& Ch, const bool& SkipEmpty=false); 00053 static int SplitLines(TChA& ChA, TVec<char *>& LineV, const bool& SkipEmpty=false); 00054 static int SplitSentences(TChA& ChA, TVec<char *>& SentenceV); 00055 static void RemoveHtmlTags(const TChA& HtmlStr, TChA& TextStr); 00056 static bool IsLatinStr(const TChA& Str, const double& MinAlFrac); 00057 static void GetWIdV(const TStrHash<TInt>& StrH, const char *CStr, TIntV& WIdV); 00058 static void GetAddWIdV(TStrHash<TInt>& StrH, const char *CStr, TIntV& WIdV); 00060 static bool GetTmFromStr(const char* TmStr, TSecTm& Tm); 00061 00063 static TStr GetStdName(TStr AuthorName); 00065 static void GetStdNameV(TStr AuthorNames, TStrV& StdNameV); 00066 };