本文整理汇总了C#中Phrase类的典型用法代码示例。如果您正苦于以下问题:C# Phrase类的具体用法?C# Phrase怎么用?C# Phrase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Phrase类属于命名空间,在下文中一共展示了Phrase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ReduceDividendForwardSlashDivisor
public static Phrase ReduceDividendForwardSlashDivisor(IFuzzyState state, Dictionary<String, Token> parameters) {
FloatNumericPrimitiveToken dividend = (FloatNumericPrimitiveToken) parameters["dividend"];
ForwardSlashPunctuationSyntaxToken forwardSlash = (ForwardSlashPunctuationSyntaxToken) parameters["forwardSlash"];
FloatNumericPrimitiveToken divisor = (FloatNumericPrimitiveToken) parameters["divisor"];
Phrase phrase = null;
if (divisor.ToFloat() != 0.0F) {
phrase = new Phrase() {
new FloatNumericPrimitiveToken() {
Value = dividend.ToFloat() / divisor.ToFloat(),
Text = String.Format("{0} {1} {2}", dividend.Text, forwardSlash.Text, divisor.Text),
Similarity = (dividend.Similarity + forwardSlash.Similarity + divisor.Similarity) / 3.0F
}
};
}
else {
// TODO: Create new token for exceptions
phrase = new Phrase() {
new FloatNumericPrimitiveToken() {
Value = 0.0F,
Text = String.Format("{0} {1} {2}", dividend.Text, forwardSlash.Text, divisor.Text),
Similarity = (dividend.Similarity + forwardSlash.Similarity + divisor.Similarity) / 3.0F
}
};
}
return phrase;
}
开发者ID:EBassie,项目名称:Potato,代码行数:29,代码来源:DivisionSecondOrderArithmeticToken.cs
示例2: putObjectString
// Map a given object path to a value in the Trie.
public bool putObjectString(Word[] characters, Phrase phrase)
{
Node p = root;
for (int n=0; n < characters.Length; n++)
{
Word character = characters[n];
// Try to get a pointer to the next node
Node child = p.getChildNode(character);
// If there is no next node, then make it.
if (child == null)
{
if (n == characters.Length - 1)
{
p.setChildNode(character, new Node(character, phrase));
return false; // False: it wasn't here already.
}
else
{
p.setChildNode(character, new Node(character));
}
}
else
{
// Move the pointer down the Trie.
p = child;
}
}
// If we get to this point, then the final node wasn't new (or we would have returned).
// So, we just need to overwrite the value in that location.
p.addPhrase(phrase);
return true; // true because we overwrote what was there.
}
开发者ID:FizzyP,项目名称:Prose,代码行数:35,代码来源:WordTrie.cs
示例3: GetPhrases
public static List<Phrase> GetPhrases(this Tree root, Rhetorica.Sentence sentence = null, string ignore = "", string punctuation = null, AnalyzerOptions options = AnalyzerOptions.None)
{
var phrases = new List<Phrase>();
for (java.util.Iterator i = root.iterator(); i.hasNext(); ) {
Tree tree = (Tree)i.next();
if (tree.isPhrasal()) {
java.util.List children = tree.getChildrenAsList();
if (children.size() == 1 && ((Tree)children.get(0)).isPhrasal())
continue;
var current = new Phrase(tree.GetTokens(root, sentence, ignore, punctuation, options));
// If current node matches previous node but for punctuation omission, replace previous with current:
bool omitFalseDuplicatePhrases = options.HasFlag(AnalyzerOptions.OmitFalseDuplicatePhrases);
if (omitFalseDuplicatePhrases) {
if (phrases.Count > 0) {
Phrase previous = phrases.Last();
if (previous.EqualExceptPunctuationOmission(current)) {
phrases[phrases.Count - 1] = current;
continue;
}
}
}
if (current.Count == 0)
continue;
phrases.Add(current);
}
}
return phrases;
}
开发者ID:priscian,项目名称:rhetorica,代码行数:33,代码来源:RhetoricaExtensionMethods.cs
示例4: GetTextPhrase
protected static Phrase GetTextPhrase(string text, bool isBold)
{
string fontName = isBold ? FontFactory.HELVETICA_BOLD : FontFactory.HELVETICA;
Phrase ph = new Phrase(text, FontFactory.GetFont(fontName, 10, new Color(51, 51, 51)));
return ph;
}
开发者ID:Terradex,项目名称:sus,代码行数:7,代码来源:RebateForm.aspx.cs
示例5: GeneratePdfElement
public override iTextSharp.text.IElement GeneratePdfElement()
{
SignaturePanelStyle style = (Manifest != null) ? Manifest.Styles.GetMergedFromConfiguration(Style) : Style;
Phrase phrase = new Phrase();
Chunk signature = new Chunk(Signature);
signature.Style.Font.Apply(style.Font);
phrase.Content.Add(signature);
phrase.Content.Add(new NewLine());
Separator separator = new Separator();
separator.Style.BorderColor = style.BorderColor;
separator.Style.Width = style.BorderWidth;
phrase.Content.Add(separator);
GenericIdentity identity = new GenericIdentity(User);
AD.ActiveDirectory activeDirectory = new AD.ActiveDirectory();
UserDescriptor adUser = activeDirectory.GetUser(identity.GetUserName());
string fullName = adUser.DisplayName;
phrase.Content.Add(new NewLine());
phrase.Content.Add(new Chunk(String.Format("{0} ({1:MMMM dd, yyyy})", fullName, Date)));
PdfPanel panel = new PdfPanel(phrase);
panel.Style.BackgroundColor = style.BackgroundColor;
panel.Style.BorderColor = style.BorderColor;
panel.Style.Padding = style.Padding;
panel.Style.BorderWidth = style.BorderWidth;
panel.Style.Width = style.Width;
return panel.GeneratePdfElement();
}
开发者ID:onesimoh,项目名称:Andamio,代码行数:34,代码来源:SignaturePanel.cs
示例6: InvokeMethod
public OperationResult<Message> InvokeMethod(Phrase phrase)
{
var res = new OperationResult<Message>();
var msg = new Message();
try
{
object mres = phrase.Method.Invoke("dummy", phrase.Params != null? phrase.Params.ToArray():null);
var mStream = new MemoryStream();
var formatter = new BinaryFormatter();
formatter.Serialize(mStream, mres);
mStream.Close();
//var marshall = new XmlSerializer(mres.GetType());
//var mStream = new MemoryStream();
//marshall.Serialize(mStream, mres);
using (var reader = new StreamReader(mStream))
{
msg.Value = reader.ReadToEnd();
}
}
catch (Exception ex)
{
res.HasError = true;
res.Message = ex.Message;
}
res.Result = msg;
return res;
}
开发者ID:Codellion,项目名称:Verso,代码行数:34,代码来源:DataCommunication.cs
示例7: Parse
public static Phrase Parse(IFuzzyState state, Phrase phrase) {
Match regexMatch = TimeVariableTemporalPrimitiveToken.RegexMatch.Match(phrase.Text);
if (regexMatch.Success == true) {
int? hours = regexMatch.Groups["hours"].Value.Length > 0 ? int.Parse(regexMatch.Groups["hours"].Value) : 0;
int? minutes = regexMatch.Groups["minutes"].Value.Length > 0 ? int.Parse(regexMatch.Groups["minutes"].Value) : 0;
int? seconds = regexMatch.Groups["seconds"].Value.Length > 0 ? int.Parse(regexMatch.Groups["seconds"].Value) : 0;
if (String.Compare(regexMatch.Groups["meridiem"].Value, "pm", StringComparison.OrdinalIgnoreCase) == 0 && hours < 12) {
hours += 12;
}
else if (String.Compare(regexMatch.Groups["meridiem"].Value, "am", StringComparison.OrdinalIgnoreCase) == 0) {
if (hours == 12) {
hours = 0;
}
}
hours %= 24;
phrase.Add(new TimeVariableTemporalPrimitiveToken() {
Pattern = new FuzzyDateTimePattern() {
Rule = TimeType.Definitive,
Hour = (regexMatch.Groups["hours"].Value.Length > 0 ? hours : null),
Minute = (regexMatch.Groups["minutes"].Value.Length > 0 ? minutes : null),
Second = (regexMatch.Groups["seconds"].Value.Length > 0 ? seconds : null)
},
Text = phrase.Text,
Similarity = 100.0F
});
}
return phrase;
}
开发者ID:EBassie,项目名称:Potato,代码行数:33,代码来源:TimeVariableTemporalPrimitiveToken.cs
示例8: ExportPDF
public static bool ExportPDF(string path)
{
try
{
// string path = "D:\\RebateForm" + confirmDetailsRow.ConfirmationID + ".pdf"; //Server.MapPath(ConfigurationManager.AppSettings["ExportPDF"] + misc.RandomString(6, true) + ".pdf");
Document document = new Document(PageSize.A4, 3, 3, 10, 10);
PdfWriter.GetInstance(document, new FileStream(path, FileMode.Create));
Phrase ph = new Phrase("All Information Deemed Accurate but not Warranted\n EQUAL HOUSING OPPERTUNITY", FontFactory.GetFont(FontFactory.HELVETICA, 10, new Color(51, 51, 51)));
HeaderFooter footer = new HeaderFooter(ph, false);
footer.Border = 0;
footer.Alignment = Element.ALIGN_CENTER;
document.Footer = footer;
document.Open();
iTextSharp.text.Table tblMain = new iTextSharp.text.Table(2);
tblMain.Border = 0;
tblMain.DefaultCellBorder = 0;
tblMain.Cellpadding = 2;
SetTitle(confirmDetailsRow, tblMain);
SetContactInfo(confirmDetailsRow, tblMain);
document.Add(tblMain);
document.Close();
return true;
}
catch (Exception)
{
//return false;
throw;
}
}
开发者ID:Terradex,项目名称:sus,代码行数:32,代码来源:RebateForm.aspx.cs
示例9: SetUpEach
public void SetUpEach()
{
db = new InMemoryDatabase ();
phrase1 = new Phrase ("Das Restaurant", "Ресторан", "audio/lesson1/00_Das_Restaurant.mp3");
phrase2 = new Phrase ("Ich bin sehr mude", "Я очень устал,", "audio/lesson1/01_Ich_bin_sehr_mude.mp3");
phrase3 = new Phrase ("1", "2", "3");
}
开发者ID:papagenoo,项目名称:BabylonMono,代码行数:7,代码来源:InMemoryPhrasesDatabaseTest.cs
示例10: GameLoop
public static void GameLoop()
{
int exactMatch = 0;
int partialMatch = 0;
int hint = 1;
bool gameOver = false;
string guessString;
Phrase actual = new Phrase();
while (!gameOver)
{
Console.Write("Enter your guess: ");
guessString = Console.ReadLine();
if (guessString == "hint")
{
string padding = new string('-', Phrase.PhraseSize - hint);
Console.WriteLine("{0}{1}", actual.Value.Substring(0, hint), padding);
// begin -- for debugging only
Console.WriteLine("{0} G x {1}", actual.Value, actual.Count.G);
Console.WriteLine("{0} A x {1}", actual.Value, actual.Count.A);
Console.WriteLine("{0} T x {1}", actual.Value, actual.Count.T);
Console.WriteLine("{0} C x {1}", actual.Value, actual.Count.C);
// end -- for debugging only
if (hint < Phrase.PhraseSize)
{
hint++;
}
else
{
Console.WriteLine("No more hints! Game Over.");
gameOver = true;
}
}
else
{
Phrase guess = new Phrase(guessString);
if (!actual.Compare(guess, out exactMatch, out partialMatch))
{
Console.WriteLine("You have {0} exact and {1} partial matches. Try again.", exactMatch, partialMatch);
}
else
{
Console.WriteLine("Congratulations! You Win!");
gameOver = true;
}
}
}
}
开发者ID:alban316,项目名称:edxCSharp,代码行数:56,代码来源:Program.cs
示例11: addPhraseAndDeleteExistingPhrases
public bool addPhraseAndDeleteExistingPhrases(Phrase phrase)
{
// Get the node where the phrase belongs
bool created;
Trie<ProseObject, List<Phrase>>.Node phraseNode = patternTrie.getOrCreateNodeAtObjectPath(phrase.getPattern(), out created);
// Make this phrase the only one at the node.
phraseNode.setValue(new List<Phrase>(1));
phraseNode.Value.Add(phrase);
return created;
}
开发者ID:FizzyP,项目名称:Prose,代码行数:11,代码来源:ProseScope.cs
示例12: Parse
public static Phrase Parse(IFuzzyState state, Phrase phrase) {
if (phrase.Text.Length > 0 && phrase.Text.First() == '"' && phrase.Text.Last() == '"' && phrase.Refactoring == false) {
phrase.Add(new StringPrimitiveToken() {
Text = phrase.Text.Trim('"'),
Similarity = 80,
Value = phrase.Text.Trim('"')
});
}
return phrase;
}
开发者ID:EBassie,项目名称:Potato,代码行数:11,代码来源:StringPrimitiveToken.cs
示例13: addPhrase
public bool addPhrase(Phrase phrase)
{
// Get the node where the phrase belongs
bool created;
Trie<ProseObject, List<Phrase>>.Node phraseNode = patternTrie.getOrCreateNodeAtObjectPath(phrase.getPattern(), out created);
// Add the phrase to the node
if (phraseNode.Value == null) // If we have to make a place in the node to put our phrase...
phraseNode.setValue(new List<Phrase>());
phraseNode.Value.Add(phrase);
return created;
}
开发者ID:FizzyP,项目名称:Prose,代码行数:12,代码来源:ProseScope.cs
示例14: Parse
public new static Phrase Parse(IFuzzyState state, Phrase phrase) {
List<SelfReflectionThingObjectToken> createdTokens = null;
TokenReflection.CreateDescendants(state, phrase, out createdTokens);
if (createdTokens != null && createdTokens.Count > 0) {
foreach (SelfReflectionThingObjectToken self in createdTokens) {
state.ParseSelfReflectionThing(state, self);
}
}
return phrase;
}
开发者ID:EBassie,项目名称:Potato,代码行数:12,代码来源:SelfReflectionThingObjectToken.cs
示例15: PhrasesEqualityTest
public void PhrasesEqualityTest()
{
Phrase p1 = new Phrase ("1", "2", "3");
Phrase p2 = new Phrase ("1", "2", "3");
Phrase p3 = new Phrase ("1", "2", "-");
Phrase p4 = new Phrase ("1", "-", "3");
Phrase p5 = new Phrase ("-", "2", "3");
Assert.IsTrue (p1.Equals (p2));
Assert.IsFalse (p1.Equals (p3));
Assert.IsFalse (p1.Equals (p4));
Assert.IsFalse (p1.Equals (p5));
}
开发者ID:papagenoo,项目名称:BabylonMono,代码行数:13,代码来源:PhraseTest.cs
示例16: Handle
public Phrase Handle(Phrase input, GrammarParser.ParaphraseOptions? opts, List<string> emph, double prob)
{
if (opts == null)
opts = GrammarParser.ParaphraseOptions.NoOptions;
List<Phrase> emphasizes = new List<Phrase>();
if (emph != null) {
foreach (string word in emph)
emphasizes.AddRange(input.FindPhrases(word));
}
return input.Parapharse(verbs, nouns, wordnet, opts.Value, emphasizes, ref prob);
}
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:13,代码来源:ParaphraseHandler.cs
示例17: Main
static void Main(string[] args)
{
List<string> resources = new List<string>();
Parser parser = new Parser(fileName);
List<Audio> phraseAudios = new List<Audio>();
phraseAudios.Add(new Audio(new Byte[10], parser.Bpm));
Phrase phrase = new Phrase(phraseAudios, parser.Difficulty);
List<Phrase> phrases = new List<Phrase>();
}
开发者ID:JonBarnard,项目名称:Rhythm-Machine,代码行数:14,代码来源:Program.cs
示例18: Say
public void Say(Phrase say, bool sayTime = false)
{
Game.ExecuteCommand("chatwheel_say " + (int)say);
if (sayTime)
{
DelayAction.Add(250, () => Game.ExecuteCommand("chatwheel_say " + (int)Phrase.CurrentTime));
Variables.Sleeper.Sleep(random.Next(3111, 3333), "CanPing");
}
else
{
Variables.Sleeper.Sleep(random.Next(1111, 1333), "CanPing");
}
}
开发者ID:IdcNoob,项目名称:Ensage,代码行数:14,代码来源:ChatWheel.cs
示例19: CreateSectionDetail
protected PdfPTable CreateSectionDetail()
{
Section section = GetCurrentSection();
PdfPTable nestedTable = null;
if (section.Type == WebConstants.SectionTypes.MULTIPLE_SELECT_LIST)
{
textCount++;
nestedTable = new PdfPTable(section.RepeatColumns);
nestedTable.DefaultCell.Border = Rectangle.NO_BORDER;
nestedTable.WidthPercentage = 100;
int index = 0;
int limit = section.Details.Count/section.RepeatColumns;
if(section.Details.Count%section.RepeatColumns != 0)
{
limit++;
}
for (int i = 0; i < section.RepeatColumns ; i++)
{
Phrase phrase = new Phrase();
for(int j=0; j < limit && index < section.Details.Count;j++)
{
if (j > 0)
{
phrase.Add(new Chunk("\n"));
}
if (section.Details[index].Selected)
{
phrase.Add(new Chunk(AddCheckedCheckBox(),0,0));
}
else
{
phrase.Add(new Chunk(AddCheckBox(), 0, 0));
}
//phrase.Add(new Chunk(" " + section.Details[index].Text));
phrase.Add(new Chunk(" " + section.Details[index].Text, FontFactory.GetFont("Arial", 9)));
index++;
}
nestedTable.AddCell(phrase);
}
}
else
{
nestedTable = new PdfPTable(1);
}
return nestedTable;
}
开发者ID:ali-codehoppers,项目名称:unchsunchs,代码行数:48,代码来源:DetailDocumentTypeGenerator.cs
示例20: AddInsertion
private void AddInsertion(AstNode node, Phrase phrase)
{
// start tag
Insertions.Add(new Insertion
{
Offset = Document.GetOffset(node.StartLocation),
Phrase = String.Format("<span class='{0}'>", phrase.ToCss())
});
// end tag
Insertions.Add(new Insertion
{
Offset = Document.GetOffset(node.EndLocation),
Phrase = "</span>"
});
}
开发者ID:shayanelhami,项目名称:syntaxtame,代码行数:16,代码来源:Code.cs
注:本文中的Phrase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论