Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
K

KhanKtk

@KhanKtk
About
Posts
4
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • spliting sentence on the basis of conjunctions
    K KhanKtk

    here is what i did using regex. it works well. But doing this way, Splitting with regex, i lost the control over the word "and" for further processing. I have a lexicon of 20 words that normally appears before the "and (اور)" in urdu language. In next step I want to have a way to check the word before "and" against the lexicon and if found the sentence is broken else display the complete sentence. private void button1_Click(object sender, EventArgs e) { { richTextBox2.Text = ""; richTextBox3.Text = ""; string[] sentences = SentenceTokenizer(richTextBox1.Text); string remSentence; // these are urdu conjunctions. i am actually working on urdu language. Regex r = new Regex("(کہ |اور | تاکہ| مگر | تاہم | کیونکہ | لیکن )"); foreach (string sentence in sentences) { remSentence = sentence; remSentence = r.Replace(remSentence, "|"); string[] phrases = remSentence.Split('|'); for (int i = 0; i < phrases.Length; i++) { richTextBox2.Text += phrases[i] + '\n'; } } } }

    C# help question

  • spliting sentence on the basis of conjunctions
    K KhanKtk

    would you plz share some coded modification?

    C# help question

  • spliting sentence on the basis of conjunctions
    K KhanKtk

    here is what i did using regex. it works well. But doing this way, Splitting with regex, i lost the control over the word "and" for further processing. I have a lexicon of 20 words that normally appears before the "and (اور)" in urdu language. In next step I want to have a way to check the word before "and" against the lexicon and if found the sentence is broken else display the complete sentence. private void button1_Click(object sender, EventArgs e) { { richTextBox2.Text = ""; richTextBox3.Text = ""; string[] sentences = SentenceTokenizer(richTextBox1.Text); string remSentence; // these are urdu conjunctions. i am actually working on urdu language. Regex r = new Regex("(کہ |اور | تاکہ| مگر | تاہم | کیونکہ | لیکن )"); foreach (string sentence in sentences) { remSentence = sentence; remSentence = r.Replace(remSentence, "|"); string[] phrases = remSentence.Split('|'); for (int i = 0; i < phrases.Length; i++) { richTextBox2.Text += phrases[i] + '\n'; } } } }

    C# help question

  • spliting sentence on the basis of conjunctions
    K KhanKtk

    Here is what i did so far. The problem is if a conjunction appears twice in the sentence the code doesnt work for the 2nd appearance of the conjunction. plz if any expert can help ? private void SplitSentence_Click(object sender, EventArgs e) { richTextBox2.Text = ""; richTextBox3.Text = ""; string[] keywords = { " or ", " and ", " hence", "so that", "however", " because" }; string[] sentences = SentenceTokenizer(richTextBox1.Text); string remSentence; foreach (string sentence in sentences) { remSentence = sentence; richTextBox3.Text = remSentence; for (int i =0; i < keywords.Length; i++) { if ((remSentence.Contains(keywords[i])))// || (remSentence.IndexOf(keywords[i]) > 0)) { richTextBox2.Text += remSentence.Substring(0, remSentence.IndexOf(keywords[i])) + '\n' + keywords[i] + '\n'; remSentence = remSentence.Substring(remSentence.IndexOf(keywords[i]) + keywords[i].Length); } } richTextBox2.Text += remSentence; } } public static string[] SentenceTokenizer(string text) { char[] sentdelimiters = new char[] { '.', '?', '۔', '؟', '\r', ':', '-' }; // '{ ',' }', '( ', ' )', ' [', ']', '>', '<','-', '_', '= ', '+','|', '\\', ':', ';', ' ', '\'', ',', '.', '/', '?', '~', '!','@', '#', '$', '%', '^', '&', '*', ' ', '\r', '\n', '\t'}; // text.Remove('\n'); return text.Split(sentdelimiters, StringSplitOptions.RemoveEmptyEntries); }

    C# help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups