using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading;
using Bytescout.PDFExtractor;
using mshtml;
using SHDocVw;
using System.Net;
using System.Collections;
namespace ChTxtPP
{
public partial class Form1 : Form
{
SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer();
public Form1()
{
InitializeComponent();
comboBox1.SelectedIndex = 0;
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex > 0)
{
if (System.IO.Directory.Exists(txtSource.Text))
{
string strMatch = "";
DirectoryInfo di = new DirectoryInfo(txtSource.Text);
var directories = di.GetFiles("*.PDF", SearchOption.AllDirectories);
int i = 0;
string pagecount = "";
progressBar1.Visible = true;
progressBar1.Maximum = directories.Length;
progressBar1.Value = 0;
foreach (FileInfo d in directories)
{
try
{
if (i % 50 == 0)
{
Thread.Sleep(500);
this.Refresh();
GC.Collect();
}
progressBar1.Value = progressBar1.Value + 1;
pagecount = TxtConversion(d.DirectoryName + "\\" + d.Name);
strMatch = strMatch + "\r\n" + BindDataDate(d.DirectoryName, d.Name.Remove(d.Name.Length - 4), pagecount);
BindData(d.DirectoryName, d.Name.Remove(d.Name.Length - 4), pagecount);
i++;
}
catch (Exception ex)
{
Dwldtxt(d.DirectoryName, d.Name.Remove(d.Name.Length - 4), ex.ToString());
}
finally
{
}
}
DwldtxtDate(txtSource.Text, strMatch);
MessageBox.Show("Successfully Completed");
progressBar1.Visible = false;
}
else
{
MessageBox.Show("please select the valid path!!!");
txtSource.Focus();
}
}
else
{
MessageBox.Show("please select Language!!!");
comboBox1.Focus();
}
}
protected string TxtConversion(string file)
{
TextExtractor extractor = new TextExtractor();
extractor.RegistrationName = "demo";
extractor.RegistrationKey = "demo";
extractor.LoadDocumentFromFile(file);
extractor.ExtractColumnByColumn = true;
string strnewfileName = file.Replace(".PDF", "_Ext.txt");
strnewfileName = strnewfileName.Replace(".pdf", "_Ext.txt");
// Save extracted text to file
extractor.SaveTextToFile(strnewfileName);
string pagecount = extractor.GetPageCount().ToString();
extractor.Dispose();
return pagecount;
}
protected string BindDataDate(string path, string sTan, string pagecount)
{
string fileLoc = path + "/" + sTan + "_Ext.txt";
string strMatch = "";
if (sTan != "")
{
StreamReader str = new StreamReader(fileLoc);
string strLings = str.ReadToEnd();
str.Close();
Match matchDt = Regex.Match(strLings.ToString(), @">>\r\nCN-.*?-[AU]\s+.*?\r\n\r\n", RegexOptions.IgnoreCase);
if (matchDt.Success)
{
strMatch = sTan.ToString() + "\t" + matchDt.Value.ToString().Trim().Split(' ')[matchDt.Value.ToString().Trim().Split(' ').Length - 1];
}
else
{
strMatch = sTan.ToString() + "\t";
}
}
return strMatch.ToString();
}
protected void BindData(string path, string sTan, string pagecount)
{
string fileLoc = path + "/" + sTan + "_Ext.txt";
//string fileLoc = "c:\\output\\" + sTan + ".txt";
if (sTan != "")
{
//fileLoc = path + "/" + sTan + ".txt";
//fileLoc = fileLoc = "c:\\output\\" + sTan + ".txt";
StreamReader str = new StreamReader(fileLoc);
string strLings = str.ReadToEnd();
str.Close();
strLings = strLings.Replace("?", " ");
strLings = strLings.Replace("\r\n", "|");
strLings = Regex.Replace(strLings, @"\s+", " ");
strLings = strLings.Replace("| |", "||");
strLings = strLings.Replace("|", "\r\n");
strLings = Regex.Replace(strLings, @"(\r\n)+", "\r\n");
strLings = strLings.Replace("[TITLE]", "\r\n[TITLE]");
strLings = strLings.Replace("[ABSTRACT]", "\r\n[ABSTRACT]");
strLings = strLings.Replace("[CLAIM", "\r\n[CLAIM");
strLings = Regex.Replace(strLings, @"\sfigs?\.?\s", " Picture ", RegexOptions.IgnoreCase);
strLings = Regex.Replace(strLings, @"\sfigures?\s", " Picture ", RegexOptions.IgnoreCase);
//strLings = Regex.Replace(strLings, @"icture I", "icture 1", RegexOptions.None);
strLings = strLings.Replace("icture I", "icture 1");
strLings = strLings.Replace("Picture 1l", "Picture 11");
strLings = strLings.Replace("Picture 1O", "Picture 10");
MatchCollection picMatch = Regex.Matches(strLings, @"\spicture\s(i|[0-9](.*?))\s", RegexOptions.IgnoreCase);
string picturetotal = "";
ArrayList WholeList = new ArrayList();
if (picMatch.Count == 0)
{
picturetotal = "1/1";
string newPic = strLings;
newPic = Regex.Replace(newPic, "[[]CLAIMS[]]", "");
newPic = Regex.Replace(newPic, "\r\n.*?\r\n.*?[T|t]homson [R|r]euters.*?\r\n", "\r\n");
newPic = Regex.Replace(newPic, "[T|t]homson [R|r]euters", " ");
newPic = Regex.Replace(newPic, "\r\n[(].*?PDF Extractor.*?[)]\r\n", "\r\n");
if (newPic.IndexOf("[DRAWING DESCRIPTION]\r\n[") != -1)
{
picturetotal = "0/0";
}
}
else if (picMatch.Count > 0)
{
foreach (Match pic in picMatch)
{
string picrep = pic.Value.ToString();
picrep = Regex.Replace(picrep, @"picture", "", RegexOptions.IgnoreCase);
picrep = picrep.Trim();
picrep = Regex.Replace(picrep, @"[^\d\-]", "|", RegexOptions.IgnoreCase);
picrep = picrep.Trim();
picrep = picrep.ToString().Split('|')[0];
if (picrep == "")
{
picrep = "0";
}
if (picrep.IndexOf("-") != -1)
{
if (picrep.ToString().Split('-')[0] != "")
{
WholeList.Add(picrep.ToString().Split('-')[0]);
}
if (picrep.ToString().Split('-')[1] != "")
{
WholeList.Add(picrep.ToString().Split('-')[1]);
}
}
else
{
if (picrep.ToString() != "")
{
WholeList.Add(picrep.ToString());
}
}
}
int max = 0; //assumes + numbers
int max2 = 0;
int temp;
foreach (string s in WholeList)
{
temp = Convert.ToInt32(s);
if (max < temp) { max2 = max; max = temp; }
if (max - max2 > 50)
{
max = max2;
break;
}
}
picturetotal = "/" + max.ToString();
}
if (strLings.IndexOf("[DESCRIPTION]") != -1)
{
strLings = strLings.Substring(0, strLings.IndexOf("[DESCRIPTION]"));
}
if (strLings != "")
{
strLings = Regex.Replace(strLings, "[[]CLAIMS[]]", "");
strLings = Regex.Replace(strLings, "\r\n.*?\r\n.*?[T|t]homson [R|r]euters.*?\r\n", "\r\n");
strLings = Regex.Replace(strLings, "[T|t]homson [R|r]euters", " ");
//strLings = Regex.Replace(strLings, "\r\n.*?PDF Extractor.*?\r\n", "\r\n");
strLings = Regex.Replace(strLings, "\r\n[(].*?PDF Extractor.*?[)]\r\n", "\r\n");
string strIPC = "";
string strTitle = "";
string strAbs = "";
string strCLM = "";
if (strLings.IndexOf("[IPC]") != -1 && strLings.IndexOf("[TITLE]") != -1)
{
strIPC = "(IPC CODE)" + strLings.Substring(strLings.IndexOf("[IPC]") + "[IPC]".Length, strLings.IndexOf("[TITLE]") - (strLings.IndexOf("[IPC]") + "[IPC]".Length));
strIPC = strIPC.Replace("\r\n", " ").Trim();
}
if (strLings.IndexOf("[TITLE]") != -1 && strLings.IndexOf("[ABSTRACT]") != -1)
{
strTitle = strLings.Substring(strLings.IndexOf("[TITLE]") + "[TITLE]".Length, strLings.IndexOf("[ABSTRACT]") - (strLings.IndexOf("[TITLE]") + "[TITLE]".Length));
strTitle = strTitle.Replace("\r\n", " ").Trim();
}
if (strLings.IndexOf("[ABSTRACT]") != -1 && strLings.IndexOf("[CLAIM ") != -1)
{
strAbs = strLings.Substring(strLings.IndexOf("[ABSTRACT]") + "[ABSTRACT]".Length, strLings.IndexOf("[CLAIM ") - (strLings.IndexOf("[ABSTRACT]") + "[ABSTRACT]".Length));
strAbs = strAbs.Replace("\r\n", " ").Trim();
}
if (strLings.IndexOf("[CLAIM ") != -1)
{
strLings = strLings.Substring(strLings.IndexOf("[CLAIM "), strLings.Length - strLings.IndexOf("[CLAIM "));
//strLings = Regex.Replace(strLings, "[[]CLAIM [0-9]+[]]", "(CLM)");
strLings = strLings.Replace("\r\n", " ");
strLings = strLings.Trim();
strLings = strLings.Replace("[CLAIM", "\r\n[CLAIM");
strLings = Regex.Replace(strLings, "[[]CLAIM ", "");
strLings = strLings.Replace("\r\n", "|");
string[] strSpt = strLings.Split(new char[] { '|' });
for (int i = 0; i < strSpt.Length; i++)
{
Match match = Regex.Match(strSpt[i], @"[0-9]+[]].*?[a-zA-Z]", RegexOptions.IgnoreCase);
if (match.Success)
{
string fVal = match.Value;
string sVal = strSpt[i].Substring(match.Value.Length - 1, strSpt[i].Length - (match.Value.Length - 1));
Match match1 = Regex.Match(fVal, @"[0-9][a-zA-Z]", RegexOptions.IgnoreCase);
fVal = fVal.Substring(0, fVal.IndexOf("]"));
strSpt[i] = "<br/>" + fVal + ". " + sVal;
}
}
strLings = string.Join(" ", strSpt);
strCLM = strLings.Replace("\r\n", "");
}
//[CLAIM
string strExtract = "<html><body><table><tr><td>" + sTan + "~~DWG " + picturetotal.ToString() + "~~" + strIPC + "~~" + strTitle + "<br/><br/>" + strAbs + "<br/>" + strCLM + "</td></tr></table></body></html>";
//strLings = "<html><body><table><tr><td>" + sTan + "~~PP " + pagecount.ToString() + "~~" + strIPC + "~~" + strTitle + "<br/><br/>" + strAbs + "<br/>" + strCLM + "</td></tr><tr><tr><td style=\"display:none\"><br/>~~SIPO~~<br/>" + SIPO(sTan) + "</td></tr></table></body></html>";
if (sTan.ToString().ToLower().IndexOf("a") != -1)
{
strLings = "<html><body><table><tr><td>" + sTan + "~~DWG " + picturetotal.ToString() + "~~" + strIPC + "~~" + strTitle + "<br/><br/>" + strAbs + "<br/>" + strCLM + "</td></tr></table></body></html>";
}
else
{
strExtract = BindHTML(strExtract.ToString());
if (comboBox1.Text == "Extract-Only")
{
strLings = "<html><body><table><tr><td>" + sTan + "~~DWG " + picturetotal.ToString() + "~~" + strIPC + "~~" + strTitle + "<br/><br/>" + strAbs + "<br/>" + strCLM + "</td></tr><tr><td><br/>~~Extraction~~<br/>" + strExtract.ToString() + "</td></tr></table></body></html>";
}
else
{
string strSipo = SIPO(sTan);
if (strSipo.Split('|').Length > 1)
{
strLings = "<html><body><table><tr><td>" + sTan + "~~DWG " + picturetotal.ToString() + "~~" + strIPC + "~~" + strTitle + strSipo.Split('|')[0] + "<br/><br/>" + strAbs + "<br/>" + strCLM + "</td></tr><tr><td><br/>~~SIPO~~<br/>" + strSipo.Split('|')[1] + "</td></tr><tr><td><br/>~~Extraction~~<br/>" + strExtract.ToString() + "</td></tr></table></body></html>";
}
else
{
strLings = "<html><body><table><tr><td>" + sTan + "~~DWG " + picturetotal.ToString() + "~~" + strIPC + "~~" + strTitle + strSipo + "<br/><br/>" + strAbs + "<br/>" + strCLM + "</td></tr><tr><td><br/>~~SIPO~~<br/>" + strSipo + "</td></tr><tr><td><br/>~~Extraction~~<br/>" + strExtract.ToString() + "</td></tr></table></body></html>";
}
}
}
//strLings = strLings + SIPO(sTan);
Dwldtxt(path, sTan, strLings);
}
}
}
protected string SIPO(string sTan)
{
string pno = sTan.Replace("CN", "");
string pnoggle = sTan.Substring(0, sTan.Length - 1);
//Creating an instance of the COM component with CLSID {0002DF01-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 80004005.
string strAbs = "";
if (IE != null)
{
object Empty = String.Empty;
object URL = "http://59.151.93.237/sipo_EN/search/tabSearch.do?method=init";
IE.Visible = false;
IE.Navigate2(ref URL, ref Empty, ref Empty, ref Empty, ref Empty);
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument)IE.Document;
HTMLSelectElement pnum = (HTMLSelectElement)myDoc.all.item("sortfiled", 0);
pnum.selectedIndex = 0;
HTMLInputElement pname = (HTMLInputElement)myDoc.all.item("a", 0);
pname.value = pno;
int ij = 0;
if (myDoc != null)
{
foreach (mshtml.HTMLImg imgElement in myDoc.images)
{
if (ij == 6)
{
((HTMLImgEvents_Event)imgElement).onclick += new mshtml.HTMLImgEvents_onclickEventHandler(Form1_onclick);
Console.WriteLine(imgElement.href);
imgElement.click();
}
ij++;
}
}
//foreach (HTMLInputElement img in imgbtns)
//{
//}
//pname.focus();
//((HTMLInputTextElementEvents2_Event)pname).onclick += new HTMLInputTextElementEvents2_onclickEventHandler(this.HandlerClick);
//((HTMLInputTextElementEvents2_Event)pname).onkeypress += new HTMLInputTextElementEvents2_onkeypressEventHandler(this.HandlerKeypress);
//HTMLInputTextElementEvents_Event focusChangeEvent = pname as HTMLInputTextElementEvents_Event;
//focusChangeEvent.onkeypress += new HTMLInputTextElementEvents_onkeypressEventHandler(focusChangeEvent_onkeypress);
//SendKeys.Send("{ENTER}");
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
myDoc = (HTMLDocument)IE.Document;
string strVal = "";
string title = "";
IHTMLElementCollection anchcollection = myDoc.getElementsByTagName("a");
int i = 0;
foreach (HTMLAnchorElement anch in anchcollection)
{
if (i == 2)
{
strVal = anch.href.ToString();
title = ((mshtml.HTMLAnchorElementClass)(anch)).innerText;
break;
}
else
{
i = i + 1;
}
}
object URL1 = strVal;
IE.Navigate2(ref URL1, ref Empty, ref Empty, ref Empty, ref Empty);
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
myDoc = (HTMLDocument)IE.Document;
string strLings = Convert.ToString(myDoc.body.innerHTML);
if (strLings.ToLower().IndexOf("<span>abstract</span>") != -1)
{
strAbs = strLings.Substring(strLings.ToLower().IndexOf("<span>abstract</span>") + "<span>abstract</span>".Length, strLings.Length - (strLings.ToLower().IndexOf("<span>abstract</span>") + "<span>abstract</span>".Length));
if (strAbs.ToLower().IndexOf("</td>") != -1)
{
strAbs = strAbs.Substring(0, strAbs.ToLower().IndexOf("</td>"));
}
}
object URL2 = "http://ip.com/pat/" + sTan.ToString();
IE.Navigate2(ref URL2, ref Empty, ref Empty, ref Empty, ref Empty);
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
{
System.Threading.Thread.Sleep(5000);
}
HTMLDocument myDocnew = new HTMLDocumentClass();
myDocnew = (HTMLDocument)IE.Document;
//XmlDocument xmlDoc = myDoc.all.item("div", 0);
//HTMLInputElement pname = (HTMLInputElement)myDoc.all.item("homeSearchBox", 0);
//string title = "";
string abs = "";
strLings = Convert.ToString(myDoc.body.innerHTML);
strLings = strLings.ToString().Replace("'", "'").Replace("“", "\"").Replace("”", "\"").Replace("‘", "'").Replace("’", "'").Replace("‘", "'").Replace("–", "-").Trim();
//strLings
strLings = Regex.Replace(strLings, @"[(](.*?)USPTO(.*?)[)]", "", RegexOptions.IgnoreCase);
//if (strLings.ToLower().IndexOf("<h2>") != -1)
//{
// title = strLings.Substring((strLings.ToLower().IndexOf("<h2>") + 4), ((strLings.ToLower().IndexOf("<span")) - (strLings.ToLower().IndexOf("<h2>") + 4)));
// title = Regex.Replace(title, @"(\r)+", "");
// title = Regex.Replace(title, @"(\n)+", "");
// title = Regex.Replace(title, @"(\t)+", "");
// title = title.Trim();
//}
strLings = strLings.Replace("<DIV>", "<div>");
strLings = strLings.Replace("</DIV>", "</div>");
Match matabs = Regex.Match(strLings, "<h3 class=\"?search-header\"?>abstract [(]english[)]</h3>", RegexOptions.IgnoreCase);
if (matabs.Success)// if (strLings.ToLower().IndexOf("<h3 class=search-header>abstract (english)</h3>") != -1)
{
strLings = strLings.Substring(strLings.IndexOf(matabs.Value), (strLings.Length - (strLings.IndexOf(matabs.Value))));
abs = strLings.Substring(matabs.Value.Length, (strLings.ToLower().IndexOf("</div>") - (matabs.Value.Length)));
//strLings = strLings.Replace(matabs.Value, "");
//strLings = strLings.Replace(abs, "");
abs = Regex.Replace(abs, @"<(.*?)>", "");
abs = Regex.Replace(abs, @"(\r)+", " ");
abs = Regex.Replace(abs, @"(\n)+", " ");
abs = Regex.Replace(abs, @"(\t)+", " ");
abs = abs.Trim();
}
strAbs = "(SIPO : " + title + ")|" + strAbs + "<br/>~~IP~~<br/>" + abs.ToString();
//URL2 = "http://search.cnipr.com/pages!advSearch.action?COLLCC=2925427020&";
//IE.Navigate2(ref URL2, ref Empty, ref Empty, ref Empty, ref Empty);
//while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
//{
// System.Threading.Thread.Sleep(5000);
//}
//while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
//{
// System.Threading.Thread.Sleep(5000);
//}
//while (IE.Busy == true || IE.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE)
//{
// System.Threading.Thread.Sleep(5000);
//}
//HTMLDocument myDoc3 = new HTMLDocumentClass();
//myDoc3 = (HTMLDocument)IE.Document;
//HTMLInputTextElement pname1 = (HTMLInputTextElement)myDoc.all.item("txt_C", 0);
//pname1.value = sTan;
//HTMLButtonElement htmlchk = (HTMLButtonElement)myDoc3.all.item("saveExpcheck", 0);
//HTMLButtonElement htmlchk1 = (HTMLButtonElement)htmlchk.nextSibling.childNodes;
//htmlchk1.click();
////if (myDoc3 != null)
////{
//// foreach (HTMLButtonElement htmlButElement in myDoc3.body.className("search_cle", 0))
//// {
//// if (ij == 6)
//// {
//// ((HTMLImgEvents_Event)imgElement).onclick += new mshtml.HTMLImgEvents_onclickEventHandler(Form1_onclick);
//// Console.WriteLine(imgElement.href);
//// imgElement.click();
//// }
//// ij++;
//// }
////}
//strAbs = strAbs + "<br/>~~CNIPR~~<br/>" + abs.ToString();
}
return strAbs.ToString();
}
private bool Form1_onclick()
{
Console.WriteLine("click !!");
return true;
}
public static string TransLateContent(string sourceText, string sourceLang, string targetLang)
{
string url = "http://api.microsofttranslator.com/V2/Ajax.svc/Translate?appId=78280AF4DFA1CE1676AFE86340C690023A5AC139&from=";
url = url + sourceLang + "&to=";
url = url + targetLang + "&text=";
url = url + sourceText;
WebProxy proxy = new WebProxy("172.16.5.9:8080");
proxy.UseDefaultCredentials = true;
WebRequest.DefaultWebProxy = proxy;
WebClient client = new WebClient();
client.Proxy = proxy;
string downloadString = client.DownloadString(url);
return downloadString;
}
private bool HandlerClick(IHTMLEventObj e)
{
IHTMLElement Element = e.srcElement;
Console.Write("Click:");
Console.WriteLine(Element.tagName);
return true;
}
private bool HandlerKeypress(IHTMLEventObj e)
{
HTMLInputTextElement Element = (HTMLInputTextElement)e.srcElement;
Console.Write("keypress:");
Console.WriteLine(Element.value);
return true;
}
protected void Dwldtxt(string path, string sTan, string strLings)
{
//string fileLoc = "c:\\output\\" + sTan + ".txt";
//string fileLocorg = "Z:\\File\\Original\\" + sTan + ".txt";
string fileLoc = path + "/" + sTan + ".txt";
//string fileLoc = "D:\\COMMON\\Chinese_Output\\" + sTan + ".txt";
string fileLocdel = path + "/" + sTan + "_Ext.txt";
if (File.Exists(fileLocdel))
{
File.Delete(fileLocdel);
}
FileStream fs = null;
if (!File.Exists(fileLoc))
{
using (fs = File.Create(fileLoc))
{
fs.Close();
}
using (StreamWriter sw = new StreamWriter(fileLoc))
{
//sw.Write(strLings);
sw.Write(strLings);
sw.Close();
}
}
else
{
using (StreamWriter sw = new StreamWriter(fileLoc))
{
//sw.Write(strLings);
sw.Write(strLings);
sw.Close();
}
}
//File.Copy(fileLoc, fileLocorg, true);
}
protected void DwldtxtDate(string path, string strLings)
{
strLings = strLings.Trim();
string fileLoc = path + "/Datelist.txt";
FileStream fs = null;
if (!File.Exists(fileLoc))
{
using (fs = File.Create(fileLoc))
{
fs.Close();
}
using (StreamWriter sw = new StreamWriter(fileLoc))
{
//sw.Write(strLings);
sw.Write(strLings);
sw.Close();
}
}
else
{
using (StreamWriter sw = new StreamWriter(fileLoc))
{
//sw.Write(strLings);
sw.Write(strLings);
sw.Close();
}
}
}
private void button3_Click(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog() != DialogResult.Cancel)
{
txtSource.Text = folderBrowserDialog1.SelectedPath;
}
else
{
txtSource.Text = "";
}
}
private void Form1_Deactivate(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
if (System.IO.Directory.Exists(txtSource.Text))
{
string strMatch = "";
DirectoryInfo di = new DirectoryInfo(txtSource.Text);
var directories = di.GetFiles("*.PDF", SearchOption.AllDirectories);
int i = 0;
string pagecount = "";
progressBar1.Visible = true;
progressBar1.Maximum = directories.Length;
progressBar1.Value = 0;
foreach (FileInfo d in directories)
{
try
{
if (i % 50 == 0)
{
Thread.Sleep(500);
this.Refresh();
GC.Collect();
}
progressBar1.Value = progressBar1.Value + 1;
pagecount = TxtConversion(d.DirectoryName + "\\" + d.Name);
strMatch = strMatch + "\r\n" + BindDataDate(d.DirectoryName, d.Name.Remove(d.Name.Length - 4), pagecount);
if (File.Exists(d.DirectoryName + "\\" + d.Name.Replace(".pdf", "").Replace(".PDF", "") + "_Ext.txt"))
{
File.Delete(d.DirectoryName + "\\" + d.Name.Replace(".pdf", "").Replace(".PDF", "") + "_Ext.txt");
}
i++;
}
catch (Exception ex)
{
Dwldtxt(d.DirectoryName, d.Name.Remove(d.Name.Length - 4), ex.ToString());
}
finally
{
}
}
DwldtxtDate(txtSource.Text, strMatch);
MessageBox.Show("Successfully Completed");
progressBar1.Visible = false;
}
else
{
MessageBox.Show("please select the valid path!!!");
txtSource.Focus();
}
}
protected string BindHTML(string strLings)
{
string strCLAIMS = "";
string strSDOAB = "";
string pagecount = "";
string authortitle = "";
if (strLings.ToLower().IndexOf("<br/>") != -1)
{
authortitle = strLings.Substring(0, strLings.ToLower().IndexOf("<br/>"));
if (authortitle.LastIndexOf("~~") != -1)
{
authortitle = "\r\n\r\n\r\nAuthor Title :\r\n" + authortitle.Substring(authortitle.LastIndexOf("~~") + 2, authortitle.Length - (authortitle.LastIndexOf("~~") + 2));
}
}
strLings = Regex.Replace(strLings, @"<br/>\s+<br/>", "<br/><br/>");
int sIdxCLAIMS = strLings.IndexOf("<br/><br/>");
if (sIdxCLAIMS != -1)
{
strLings = strLings.Substring(sIdxCLAIMS + "<br/><br/>".Length, strLings.Length - (sIdxCLAIMS + "<br/><br/>".Length));
}
int eIdxCLAIMS = strLings.IndexOf("<br/><br/>");
if (sIdxCLAIMS != -1)
{
strSDOAB = strLings.Substring(0, eIdxCLAIMS);
strCLAIMS = strLings.Substring(eIdxCLAIMS + "<br/><br/>".Length, strLings.IndexOf("</td>") - (eIdxCLAIMS + "<br/><br/>".Length));
}
strCLAIMS = strCLAIMS.Replace("<br/>", "|");
while (strCLAIMS.IndexOf(" ") > -1)
{
strCLAIMS = strCLAIMS.Replace(" ", " ");
}
while (strCLAIMS.IndexOf("| |") > -1)
{
strCLAIMS = strCLAIMS.Replace("| |", "||");
}
while (strCLAIMS.IndexOf("||") > -1)
{
strCLAIMS = strCLAIMS.Replace("||", "|");
}
if (strCLAIMS.IndexOf("|") == 0)
{
strCLAIMS = strCLAIMS.Substring(1, strCLAIMS.Length - 1);
}
if (strCLAIMS.LastIndexOf("|") >= 0)
{
strCLAIMS = strCLAIMS.Substring(0, strCLAIMS.Length - 1);
}
//int max = 0;
//int a = 0;
ArrayList splCLM = new ArrayList();
// strCLAIMS.Split(new char[] { '|' });
string[] splCLM1 = strCLAIMS.Split(new char[] { '|' });
for (int kk = 0; kk < splCLM1.Length; kk++)
{
if (splCLM1[kk].IndexOf(".") != -1)
{
splCLM1[kk] = splCLM1[kk].Substring(0, splCLM1[kk].IndexOf(".") + 1) + " " + splCLM1[kk].Substring(splCLM1[kk].IndexOf(".") + 1, splCLM1[kk].Length - (splCLM1[kk].IndexOf(".") + 1));
splCLM1[kk] = splCLM1[kk].Trim();
}
}
for (int i = 0; i < splCLM1.Length; i++)
{
splCLM.Add(splCLM1[i].Substring(2, splCLM1[i].Length - 2).Trim());
}
string splCLMtrim = "";
while (splCLM[0].ToString().Length < 600)
{
if (splCLM.Count <= 1)
{
break;
}
splCLMtrim = splCLM[1].ToString();
if (splCLMtrim.IndexOf(" claim ") != -1)
{
splCLMtrim = splCLMtrim.Substring(splCLMtrim.IndexOf(" claim ") + 6, splCLMtrim.Length - splCLMtrim.IndexOf(" claim ") - 6);
}
if (splCLMtrim.IndexOf(",") != -1)
{
splCLM[1] = splCLMtrim.Substring(splCLMtrim.IndexOf(",") + 1, splCLMtrim.Length - splCLMtrim.IndexOf(",") - 1);
}
splCLM[0] = splCLM[0] + " $$ " + splCLM[1];
splCLM.RemoveAt(1);
}
strLings = splitprocess_UtiT(splCLM[0].ToString().Replace("'", "`"), strSDOAB.Replace("'", "`"), strCLAIMS.Replace("'", "`"));
return strLings.ToString();
}
protected string splitprocess_UtiT(string novVal, string compareVal, string fullclaims)
{
int firstVal = 0;
int secondVal = 0;
string valPart = "";
string prevalPart = "";
string precompareVal = "";
string novValhd = "";
string novValhdRem = "";
int stVal = 0;
int firstVal1 = 0;
int prefirstVal1 = 0;
int prefirstVal2 = 0;
var comVal = compareVal;
while (compareVal.IndexOf("(") != -1 && compareVal.IndexOf(")") != -1)
{
firstVal = 0;
secondVal = 0;
valPart = "";
stVal = 0;
firstVal1 = 0;
prefirstVal1 = 0;
prefirstVal2 = 0;
firstVal = compareVal.IndexOf("(");
secondVal = compareVal.IndexOf(")");
if (firstVal < compareVal.Substring(0, secondVal).LastIndexOf("("))
{
firstVal = compareVal.Substring(0, secondVal).LastIndexOf("(");
}
valPart = compareVal.Substring(firstVal, secondVal + 1 - firstVal);
precompareVal = compareVal.Substring(0, firstVal);
string[] maxCheck = { " a ", "A ", " A ", " an ", "An ", " An ", "AN ", " AN ", " the ", "The ", " The ", "THE ", " THE ", " multiple ", " Multiple ", "Multiple ", " MULTIPLE ", "MULTIPLE ", " set of ", " Set of ", "Set of ", "SET OF ", " SET OF ", "SAID ", "Said ", "said " };
int min11 = 0;
for (int k1 = 0; k1 < maxCheck.Length; k1++)
{
if (precompareVal.ToLower().LastIndexOf(maxCheck[k1]) != -1)
{
if (min11 < precompareVal.ToLower().LastIndexOf(maxCheck[k1]))
{
min11 = precompareVal.ToLower().LastIndexOf(maxCheck[k1]);
prevalPart = precompareVal.Substring(precompareVal.ToLower().LastIndexOf(maxCheck[k1]), precompareVal.Length - precompareVal.ToLower().LastIndexOf(maxCheck[k1]));
}
}
}
prevalPart = prevalPart.Trim();
compareVal = compareVal.Substring(secondVal + 1, compareVal.Length - (secondVal + 1));
if (novVal.IndexOf(valPart) == -1)
{
if (novVal.IndexOf(prevalPart) != -1)
{
novVal = novVal.Replace(prevalPart, prevalPart + " " + valPart);
}
}
}
ArrayList lnkwrd = new ArrayList();
ArrayList sptwrd = new ArrayList();
lnkwrd.Add(" compris");
lnkwrd.Add(" includ");
lnkwrd.Add(" consist");
lnkwrd.Add(" equipped with ");
lnkwrd.Add(" has ");
lnkwrd.Add(" whose ");
lnkwrd.Add(" compose");
lnkwrd.Add(" wherein ");
lnkwrd.Add(" belong ");
lnkwrd.Add(" suitable ");
lnkwrd.Add(" refer ");
lnkwrd.Add(" applied ");
lnkwrd.Add(" use ");
lnkwrd.Add(" particular ");
lnkwrd.Add(" especially ");
lnkwrd.Add(" provided on ");
lnkwrd.Add(" provided with ");
lnkwrd.Add(" which ");
lnkwrd.Add(" formed by ");
sptwrd.Add(" for ");
sptwrd.Add(" of ");
sptwrd.Add(" with ");
sptwrd.Add(" that ");
sptwrd.Add(" to be ");
sptwrd.Add("ed to ");
sptwrd.Add(" in ");
sptwrd.Add(" on ");
sptwrd.Add(" without ");
sptwrd.Add(" used for ");
sptwrd.Add(" fit ");
sptwrd.Add(" embedded ");
sptwrd.Add(" configured on ");
sptwrd.Add(" suited ");
sptwrd.Add(" being suited ");
sptwrd.Add(" capable of ");
sptwrd.Add(" based on ");
sptwrd.Add(" available ");
sptwrd.Add(" connected by ");
sptwrd.Add(" being ");
int min1 = novVal.Length;
for (int k = 0; k < lnkwrd.Count; k++)
{
if (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) != -1)
{
if (k == 0)
{
if (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) == novVal.ToLower().IndexOf(" comprising "))
{
lnkwrd[0] = " comprising ";
}
}
if (k == 0)
{
if (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) == novVal.ToLower().IndexOf(" comprises "))
{
lnkwrd[0] = " comprises ";
}
}
if (k == 0)
{
if (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) == novVal.ToLower().IndexOf(" comprises of "))
{
lnkwrd[0] = " comprises of ";
}
}
if (k == 1)
{
if (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) == novVal.ToLower().IndexOf(" including "))
{
lnkwrd[1] = " including ";
}
}
if (k == 1)
{
if (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) == novVal.ToLower().IndexOf(" includes "))
{
lnkwrd[1] = " includes ";
}
}
if (k == 2)
{
if (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) == novVal.ToLower().IndexOf(" consisting of "))
{
lnkwrd[2] = " consisting of ";
}
}
if (k == 2)
{
if (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) == novVal.ToLower().IndexOf(" consists "))
{
lnkwrd[2] = " consists ";
}
}
if (k == 7)
{
if (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) == novVal.ToLower().IndexOf(" composed of "))
{
lnkwrd[7] = " composed of ";
}
}
if (k == 9)
{
if (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) == novVal.ToLower().IndexOf(" belonging "))
{
lnkwrd[9] = " belonging ";
}
}
if (k == 12)
{
if (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) == novVal.ToLower().IndexOf(" capable of "))
{
lnkwrd[12] = " capable of ";
}
}
if (min1 > novVal.ToLower().IndexOf(lnkwrd[k].ToString()))
{
min1 = novVal.ToLower().IndexOf(lnkwrd[k].ToString());
novValhd = novVal.Substring(0, novVal.ToLower().IndexOf(lnkwrd[k].ToString()));
novValhdRem = novVal.Substring(novVal.ToLower().IndexOf(lnkwrd[k].ToString()) + lnkwrd[k].ToString().Length - 1, novVal.Length - (novVal.ToLower().IndexOf(lnkwrd[k].ToString()) + lnkwrd[k].ToString().Length - 1));
novValhdRem = novValhdRem.Substring(novValhdRem.IndexOf(" "), novValhdRem.Length - novValhdRem.IndexOf(" "));
}
}
}
if (novValhdRem.ToLower().IndexOf("steps as follows") != -1)
{
novValhdRem = novValhdRem.Substring(novValhdRem.ToLower().IndexOf("steps as follows") + "steps as follows".Length, novValhdRem.Length - (novValhdRem.ToLower().IndexOf("steps as follows") + "steps as follows".Length));
if (novValhdRem.ToLower().IndexOf(" ") != -1)
{
novValhdRem = novValhdRem.Substring(novValhdRem.ToLower().IndexOf(" ") + " ".Length, novValhdRem.Length - (novValhdRem.ToLower().IndexOf(" ") + " ".Length));
}
}
else if (novValhdRem.ToLower().IndexOf("following steps") != -1)
{
novValhdRem = novValhdRem.Substring(novValhdRem.ToLower().IndexOf("following steps") + "following steps".Length, novValhdRem.Length - (novValhdRem.ToLower().IndexOf("following steps") + "following steps".Length));
if (novValhdRem.ToLower().IndexOf(" ") != -1)
{
novValhdRem = novValhdRem.Substring(novValhdRem.ToLower().IndexOf(" ") + " ".Length, novValhdRem.Length - (novValhdRem.ToLower().IndexOf(" ") + " ".Length));
}
}
if (novValhd.ToLower().IndexOf("a kind of") != -1)
{
novValhd = (novValhd.Substring(novValhd.ToLower().IndexOf("a kind of") + "a kind of".Length, novValhd.Length - (novValhd.ToLower().IndexOf("a kind of") + "a kind of".Length))).Trim();
}
if (novValhd.ToLower().IndexOf("the kind of") != -1)
{
novValhd = (novValhd.Substring(novValhd.ToLower().IndexOf("the kind of") + "the kind of".Length, novValhd.Length - (novValhd.ToLower().IndexOf("the kind of") + "the kind of".Length))).Trim();
}
if (novValhd.ToLower().IndexOf("one kind of") != -1)
{
novValhd = (novValhd.Substring(novValhd.ToLower().IndexOf("one kind of") + "one kind of".Length, novValhd.Length - (novValhd.ToLower().IndexOf("one kind of") + "one kind of".Length))).Trim();
}
string claimhdful = novValhd;
if (novValhd.ToLower().IndexOf(" method ") != -1)
{
novValhd = "method";
}
if (novValhd == "" || novValhdRem == "")
{
if (novVal.ToLower().IndexOf(",") != -1)
{
novValhd = novVal.Substring(0, novVal.ToLower().IndexOf(","));
novValhdRem = novVal.Substring(novVal.ToLower().IndexOf(",") + ",".Length - 1, novVal.Length - (novVal.ToLower().IndexOf(",") + ",".Length - 1));
}
string[] tmp = novVal.Split(new char[] { ' ' });
if (tmp.Length > 7)
{
claimhdful = tmp[0] + " " + tmp[1] + " " + tmp[2] + " " + tmp[3] + " " + tmp[4] + " " + tmp[5] + " " + tmp[6] + " " + tmp[7];
}
else
{
claimhdful = novValhd;
}
}
// var claimhdful = novValhd;
// debugger;
string novValhdnew = "";
int min2 = novValhd.Length;
for (int l = 0; l < sptwrd.Count; l++)
{
if (novValhd.ToLower().IndexOf(sptwrd[l].ToString()) != -1)
{
if (min2 > novValhd.ToLower().IndexOf(sptwrd[l].ToString()))
{
min2 = novValhd.ToLower().IndexOf(sptwrd[l].ToString());
if (sptwrd[l] == " of " && (novValhd.ToLower().IndexOf(" piece" + sptwrd[l].ToString()) != -1 || novValhd.ToLower().IndexOf(" improvement" + sptwrd[l].ToString()) != -1))
{
novValhdnew = novValhd;
}
else
{
novValhdnew = novValhd.Substring(0, novValhd.ToLower().IndexOf(sptwrd[l].ToString()));
if (sptwrd[l].ToString() == "ed to ")
{
novValhdnew = novValhdnew.Substring(0, novValhdnew.ToLower().LastIndexOf(" "));
}
}
}
}
}
// debugger;
if (novValhdnew == "")
{
// if (novValhd.ToLower().IndexOf(",") != -1) {
// novValhdnew = novValhd.Substring(0, novValhd.ToLower().IndexOf(","));
// }
// else {
novValhdnew = novValhd;
// }
}
// debugger;
// novValhd = novValhd.replace(",", "");
// novValhdnew = novValhdnew.replace(",", "");
int comcnt = 0;
string tempnovValhdnew = novValhdnew;
while (tempnovValhdnew.IndexOf(",") != -1)
{
comcnt++;
tempnovValhdnew = tempnovValhdnew.Substring(tempnovValhdnew.IndexOf(",") + 1, tempnovValhdnew.Length - (tempnovValhdnew.IndexOf(",") + 1));
if (comcnt > 1)
{
break;
}
}
if (comcnt > 1)
{
if (novValhdnew.LastIndexOf(",") != -1)
{
novValhdnew = novValhdnew.Substring(0, novValhdnew.LastIndexOf(","));
}
if (novValhdnew.LastIndexOf(" ") != -1)
{
novValhd = novValhdnew.Substring(novValhdnew.LastIndexOf(" "), novValhdnew.Length - (novValhdnew.LastIndexOf(" ")));
}
}
else
{
if (novValhd.Substring(novValhd.Length - 1, novValhd.Length - (novValhd.Length - 1)) == ",")
{
novValhd = novValhd.Substring(0, novValhd.Length - 1);
}
if (novValhdnew.Substring(novValhdnew.Length - 1, novValhdnew.Length - (novValhdnew.Length - 1)) == ",")
{
novValhdnew = novValhdnew.Substring(0, novValhdnew.Length - 1);
}
if (novValhd != novValhdnew)
{
if (novValhdnew.LastIndexOf(" ") != -1)
{
if (novValhdnew != "")
{
novValhd = novValhdnew.Substring(novValhdnew.LastIndexOf(" "), novValhdnew.Length - (novValhdnew.LastIndexOf(" ")));
}
else
{
novValhd = novValhd.Substring(novValhd.LastIndexOf(" "), novValhd.Length - (novValhd.LastIndexOf(" ")));
}
}
}
else
{
string lart = "";
if (novValhd.IndexOf(" ") != -1)
{
lart = novValhd.Substring(0, novValhd.IndexOf(" "));
}
if (lart.ToLower() == "a" || lart.ToLower() == "an" || lart.ToLower() == "the")
{
novValhd = novValhd.Substring(novValhd.IndexOf(" "), novValhd.Length - (novValhd.IndexOf(" ")));
}
}
}
novValhd = novValhd.Replace(",", "");
// debugger;
string chknew = "";
if (novValhd.LastIndexOf(" ") != -1)
{
chknew = novValhd.Substring(novValhd.LastIndexOf(" "), novValhd.Length - (novValhd.LastIndexOf(" ")));
}
if (chknew.ToLower().Trim() != "method" && chknew.ToLower().Trim() != "procedure" && chknew.ToLower().Trim() != "process" && chknew.ToLower().Trim() != "technique" && chknew.ToLower().Trim() != "preparation")
{
novVal = "The " + novValhd + " has " + novValhdRem;
}
else
{
novVal = "The " + novValhd + " involves " + novValhdRem;
}
ArrayList vpart = new ArrayList();
ArrayList vpartpre = new ArrayList();
string vpartp = "";
int fVal = -1;
int sVal = -1;
int m = 0;
string novValfinal = novVal;
while (novValfinal.IndexOf("(") != -1 && novValfinal.IndexOf(")") != -1)
{
sVal = novValfinal.IndexOf(")");
fVal = novValfinal.Substring(0, sVal).LastIndexOf("(");
if (fVal != -1)
{
fVal = novValfinal.Substring(0, sVal).LastIndexOf("(");
vpart.Add(" ");
vpart[m] = novValfinal.Substring(fVal, (sVal + 1) - fVal);
vpartp = novValfinal.Substring(0, fVal - 1);
vpartpre.Add(" ");
vpartpre[m] = vpartp.Substring(vpartp.LastIndexOf(" ") + 1, vpartp.Length - (vpartp.LastIndexOf(" ") + 1));
// debugger;
novValfinal = novValfinal.Substring(sVal + 1, novValfinal.Length - (sVal + 1));
for (int n = 0; n < vpartpre.Count; n++)
{
if (vpart[n] == vpart[m] && vpartpre[n] == vpartpre[m] && m != n)
{
if (novVal.LastIndexOf(novValfinal) != -1)
{
novVal = novVal.Substring(0, novVal.LastIndexOf(novValfinal));
}
// novVal = novVal.replace(novValfinal, "");
novVal = novVal.Substring(0, novVal.Length - vpart[m].ToString().Length);
novVal = novVal + " " + novValfinal;
// novVal = novVal.replace(/" "/gi, " ");
vpart.RemoveAt(vpart.Count);
m--;
break;
}
}
m++;
}
else
{
novValfinal = novValfinal.Substring(sVal + 1, novValfinal.Length - (sVal + 1));
}
}
while (novVal.IndexOf(" ") != -1)
{
novVal = novVal.Replace(" ", " ").Trim();
}
// debugger;
//novVal = fntable(8, novVal);
//novVal = trim(novVal);
if (novVal.Length > 0)
{
if (novVal.IndexOf("has ") != 0 && novVal.IndexOf("involves ") != 0)
{
novVal = novVal.Substring(0, 1).ToUpper() + novVal.Substring(1, novVal.Length - 1);
}
}
if (novVal.IndexOf("method involves") != -1)
{
novVal = "The method involves" + novVal.Substring(novVal.IndexOf("method involves") + "method involves".Length, novVal.Length - (novVal.IndexOf("method involves") + "method involves".Length));
}
else if (novVal.IndexOf("method has") != -1)
{
novVal = "The method involves" + novVal.Substring(novVal.IndexOf("method has") + "method has".Length, novVal.Length - (novVal.IndexOf("method has") + "method has".Length));
}
novVal = novVal.Replace("it comprises:", "");
novVal = Regex.Replace(novVal, @"\s+", " ", RegexOptions.IgnoreCase);
//MessageBox.Show(novVal);
string fulluse = splitUseT(claimhdful, comVal, fullclaims);
novVal = splitTitleT(novVal, fulluse);
return novVal.ToString();
}
protected string splitUseT(string claimhdful, string AbsVal, string fullclaims)
{
// debugger;
string[] claimhdsplt = claimhdful.Split(' ');
if (claimhdsplt[0].ToString().ToLower() == "a" || claimhdsplt[0].ToString().ToLower() == "an" || claimhdsplt[0].ToString().ToLower() == "the")
{
claimhdful = claimhdful.Substring(claimhdsplt[0].ToString().Length, claimhdful.Length - claimhdsplt[0].ToString().Length).Trim();
}
// debugger;
claimhdsplt = claimhdful.Split(' ');
string claimhd = "";
if (claimhdsplt.Length > 5)
{
claimhd = claimhdsplt[0] + " " + claimhdsplt[1] + " " + claimhdsplt[2] + " " + claimhdsplt[3] + " " + claimhdsplt[4];
}
else
{
claimhd = claimhdful.Trim();
}
string AbsValsplt = Regex.Replace(AbsVal, @"[;.]", "|", RegexOptions.None);
string[] tempAbs = AbsValsplt.Split('|');
string[] tempclm = fullclaims.Split('|');
ArrayList abslnkwrd = new ArrayList();
abslnkwrd.Add(" belonging to ");
abslnkwrd.Add(" belonging ");
abslnkwrd.Add(" belongs to ");
abslnkwrd.Add(" belongs ");
abslnkwrd.Add(" belong to ");
abslnkwrd.Add(" belong ");
abslnkwrd.Add(" referring to ");
abslnkwrd.Add(" referring ");
abslnkwrd.Add(" refers to ");
abslnkwrd.Add(" refers ");
abslnkwrd.Add(" refer to ");
abslnkwrd.Add(" refer ");
abslnkwrd.Add(" suitable for ");
abslnkwrd.Add(" suitable ");
abslnkwrd.Add(" applied to ");
abslnkwrd.Add(" applied ");
abslnkwrd.Add(" used for ");
abslnkwrd.Add(" used to ");
abslnkwrd.Add(" used ");
abslnkwrd.Add(" used as ");
abslnkwrd.Add(" particularly ");
abslnkwrd.Add(" particular ");
abslnkwrd.Add(" especially ");
abslnkwrd.Add(" specifically to ");
abslnkwrd.Add(" specifically ");
abslnkwrd.Add(" adapted to ");
abslnkwrd.Add(" adapted ");
abslnkwrd.Add(" adapts to ");
abslnkwrd.Add(" adapts ");
abslnkwrd.Add(" adapt to ");
abslnkwrd.Add(" adapt ");
abslnkwrd.Add(" adopting to ");
abslnkwrd.Add(" adopting ");
abslnkwrd.Add(" adopted to ");
abslnkwrd.Add(" adopted ");
abslnkwrd.Add(" adopts to ");
abslnkwrd.Add(" adopts ");
abslnkwrd.Add(" adopt to ");
abslnkwrd.Add(" adopt ");
abslnkwrd.Add(" fits ");
abslnkwrd.Add(" fit to ");
abslnkwrd.Add(" fit ");
abslnkwrd.Add(" such as ");
abslnkwrd.Add(" relate ");
abslnkwrd.Add(" relate to ");
abslnkwrd.Add(" relates ");
abslnkwrd.Add(" relates to ");
abslnkwrd.Add(" relating ");
abslnkwrd.Add(" relating to ");
abslnkwrd.Add(" utilize ");
abslnkwrd.Add(" utilizes ");
abslnkwrd.Add(" utilized ");
abslnkwrd.Add(" utility model is a ");
abslnkwrd.Add(" used in ");
ArrayList abslnkdlmtr = new ArrayList();
abslnkdlmtr.Add(" compris");
abslnkdlmtr.Add(" includ");
abslnkdlmtr.Add(" consist");
abslnkdlmtr.Add(" equipped with");
abslnkdlmtr.Add(" has");
abslnkdlmtr.Add(" with");
abslnkdlmtr.Add(" whose");
abslnkdlmtr.Add(" wherein");
abslnkdlmtr.Add(" compose");
abslnkdlmtr.Add(" which");
bool flag = true;
string canVal = "";
string tempAbstmp = "";
string absplus = "";
string tempAbstmpt = "";
for (int i = 0; i < tempAbs.Length; i++)
{
tempAbstmp = "";
if (tempAbs[i].ToLower().IndexOf(" can ") != -1)
{
canVal = canVal + " $$ " + tempAbs[i];
}
for (int j = 0; j < abslnkwrd.Count; j++)
{
if (tempAbs[i].ToString().ToLower().IndexOf(abslnkwrd[j].ToString()) != -1)
{
tempAbstmpt = tempAbs[i].Substring(tempAbs[i].ToString().ToLower().IndexOf(abslnkwrd[j].ToString()) + 1, tempAbs[i].ToString().Length - (tempAbs[i].ToString().ToLower().IndexOf(abslnkwrd[j].ToString()) + 1));
tempAbstmp = tempAbs[i].Substring(tempAbs[i].ToString().ToLower().IndexOf(abslnkwrd[j].ToString()) + abslnkwrd[j].ToString().Length - 1, tempAbs[i].ToString().Length - (tempAbs[i].ToString().ToLower().IndexOf(abslnkwrd[j].ToString()) + abslnkwrd[j].ToString().Length - 1));
tempAbstmp = tempAbstmp.Trim();
var fart = tempAbstmp.Substring(0, tempAbstmp.IndexOf(" "));
if (fart.ToLower() == "a" || fart.ToLower() == "an" || fart.ToLower() == "the")
{
tempAbstmp = tempAbstmp.Substring(tempAbstmp.IndexOf(" ") + 1, tempAbstmp.Length - (tempAbstmp.IndexOf(" ") + 1));
}
for (int dlj = 0; dlj < abslnkdlmtr.Count; dlj++)
{
if (tempAbstmpt.ToLower().IndexOf(abslnkdlmtr[dlj].ToString()) != -1)
{
tempAbstmpt = tempAbstmpt.Substring(0, tempAbstmpt.ToLower().IndexOf(abslnkdlmtr[dlj].ToString()) + 1);
}
}
if (tempAbstmp.ToLower().Trim() != claimhdful.ToLower().Trim() && claimhdful.ToLower().IndexOf(tempAbstmp.ToLower()) == -1 && tempAbstmp.ToLower().IndexOf(claimhdful.ToLower()) == -1)
{
if (flag != true)
{
absplus = absplus + " $$ " + tempAbstmpt;
}
else
{
absplus = tempAbstmpt;
flag = false;
}
}
break;
}
}
}
int clmcnt = 0;
string tempclmhd = "";
string claimhdrem = "";
string tempclmhdful = "";
int cnt = 0;
ArrayList lnkwrd = new ArrayList();
lnkwrd.Add(" compris");
lnkwrd.Add(" includ");
lnkwrd.Add(" consist");
lnkwrd.Add(" equipped with");
lnkwrd.Add(" has");
lnkwrd.Add(" with");
lnkwrd.Add(" whose");
lnkwrd.Add(" wherein");
lnkwrd.Add(" compose");
lnkwrd.Add(" which");
// var sptwrd = new Array();
int min1 = 0;
string[] tempclmsplt;
string[] fullclmhd;
bool clmbool = true;
for (int l = 1; l < tempclm.Length; l++)
{
// debugger;
if (tempclm[l].ToString().ToLower().IndexOf("according to claim") != -1 || tempclm[l].ToString().ToLower().IndexOf("in claim") != -1 || tempclm[l].ToString().ToLower().IndexOf("according to any one of claims") != -1 || tempclm[l].ToString().ToLower().IndexOf("any said claim") != -1 || tempclm[l].ToString().ToLower().IndexOf("as per claim") != -1 || tempclm[l].ToString().ToLower().IndexOf("of claim") != -1 || (tempclm[l].ToString().ToLower().IndexOf("according to") < 10 && tempclm[l].ToString().ToLower().IndexOf("according to") != -1) || (tempclm[l].ToString().ToLower().IndexOf("wherein") < 10 && tempclm[l].ToString().ToLower().IndexOf("wherein") != -1))
{
tempclm[l] = "";
}
else
{
tempclmsplt = tempclm[l].ToString().Split(' ');
tempclmsplt[1] = Regex.Replace(tempclmsplt[1].ToString(), @"[^a-zA-Z]", "");
if (tempclmsplt[1].ToString().ToLower() != "the")
{
if (tempclmsplt[1].ToString().ToLower() == "a" || tempclmsplt[1].ToString().ToLower() == "an")
{
tempclm[l] = tempclm[l].ToString().Substring(tempclmsplt[0].ToString().Length + tempclmsplt[1].ToString().Length + 1, tempclm[l].ToString().Length - (tempclmsplt[0].ToString().Length + tempclmsplt[1].ToString().Length + 1));
tempclm[l] = tempclm[l].ToString().Trim();
}
// else if (tempclmsplt[1].ToLower() == "the") {
// tempclm[l] = "";
// }
else
{
tempclm[l] = tempclm[l].Substring(tempclmsplt[0].ToString().Length + 1, tempclm[l].ToString().Length - (tempclmsplt[0].ToString().Length + 1));
tempclm[l] = tempclm[l].ToString().Trim();
}
//string tc = "";
int minnn1 = tempclm[l].ToString().ToLower().IndexOf(",") + ",".Length;
if (tempclm[l].ToString().ToLower().IndexOf("according to ") == 0)
{
if (tempclm[l].ToString().ToLower().IndexOf(" a ") < minnn1 && tempclm[l].ToString().ToLower().IndexOf(" a ") != -1)
{
minnn1 = tempclm[l].ToString().ToLower().IndexOf(" a ") + " a ".Length;
}
if (tempclm[l].ToString().ToLower().IndexOf(" an ") < minnn1 && tempclm[l].ToString().ToLower().IndexOf(" an ") != -1)
{
minnn1 = tempclm[l].ToString().ToLower().IndexOf(" an ") + " an ".Length;
}
if (tempclm[l].ToString().ToLower().IndexOf(" the ") < minnn1 && tempclm[l].ToString().ToLower().IndexOf(" the ") != -1)
{
minnn1 = tempclm[l].ToString().ToLower().IndexOf(" the ") + " the ".Length;
}
if (tempclm[l].ToString().ToLower().IndexOf(",") != -1)
{
tempclm[l] = tempclm[l].ToString().Substring(minnn1, tempclm[l].ToString().Length - minnn1).Trim();
}
if (tempclm[l].ToString().ToLower().IndexOf("wherein the") == 0)
{
tempclm[l] = tempclm[l].ToString().Substring(tempclm[l].ToString().ToLower().IndexOf("wherein the") + "wherein the".Length, tempclm[l].ToString().Length - (tempclm[l].ToString().ToLower().IndexOf("wherein the") + "wherein the".Length)).Trim();
}
if (tempclm[l].ToString().ToLower().IndexOf("wherein") == 0)
{
tempclm[l] = tempclm[l].ToString().Substring(tempclm[l].ToString().ToLower().IndexOf("wherein") + "wherein".Length, tempclm[l].ToString().Length - (tempclm[l].ToString().ToLower().IndexOf("wherein") + "wherein".Length)).Trim();
}
}
else if (tempclm[l].ToString().ToLower().IndexOf("kind of ") == 0)
{
tempclm[l] = tempclm[l].ToString().Substring(tempclm[l].ToString().ToLower().IndexOf("kind of ") + "kind of ".Length, tempclm[l].ToString().Length - (tempclm[l].ToString().ToLower().IndexOf("kind of ") + "kind of ".Length));
}
if (tempclm[l].ToString().ToLower().IndexOf("a ") == 0)
{
tempclm[l] = tempclm[l].ToString().Substring(tempclm[l].ToString().ToLower().IndexOf("a ") + "a ".Length, tempclm[l].ToString().Length - (tempclm[l].ToString().ToLower().IndexOf("a ") + "a ".Length)).Trim();
}
else if (tempclm[l].ToString().ToLower().IndexOf("an ") == 0)
{
tempclm[l] = tempclm[l].ToString().Substring(tempclm[l].ToString().ToLower().IndexOf("an ") + "an ".Length, tempclm[l].ToString().Length - (tempclm[l].ToString().ToLower().IndexOf("an ") + "an ".Length)).Trim();
}
else if (tempclm[l].ToString().ToLower().IndexOf("the ") == 0)
{
tempclm[l] = tempclm[l].ToString().Substring(tempclm[l].ToString().ToLower().IndexOf("the ") + "the ".Length, tempclm[l].ToString().Length - (tempclm[l].ToString().ToLower().IndexOf("the ") + "the ".Length)).Trim();
}
// insert
cnt = 0;
min1 = tempclm[l].ToString().Length;
//debugger;
fullclmhd = claimhd.Split('|');
for (var n = 0; n < fullclmhd.Length; n++)
{
var tmpc = "";
if (tempclmhdful.ToLower().IndexOf("according to claim") != -1)
{
tmpc = tempclm[l].ToString().Substring(0, tempclm[l].ToString().ToLower().IndexOf("according to claim")).Trim();
}
else if (tempclmhdful.ToLower().IndexOf("any said claim") != -1)
{
tmpc = tempclm[l].ToString().Substring(0, tempclm[l].ToString().ToLower().IndexOf("any said claim")).Trim();
}
else if (tempclmhdful.ToLower().IndexOf("as per claim") != -1)
{
tmpc = tempclm[l].ToString().Substring(0, tempclm[l].ToString().ToLower().IndexOf("as per claim")).Trim();
}
else if (tempclmhdful.ToLower().IndexOf("of claim") != -1)
{
tmpc = tempclm[l].ToString().Substring(0, tempclm[l].ToString().ToLower().IndexOf("of claim")).Trim();
}
else
{
tmpc = tempclm[l].ToString().Substring(0, tempclm[l].ToString().ToLower().IndexOf(",")).Trim();
}
string[] asplt = tmpc.Split(' ');
if (asplt.Length > 5)
{
if (tempclm[l].ToString().ToLower().IndexOf(fullclmhd[n].ToLower()) != 0)
{
cnt = cnt + 1;
}
}
else
{
string[] bsplt = fullclmhd[n].Split(' ');
if (asplt.Length >= bsplt.Length)
{
if (tmpc.ToLower().IndexOf(fullclmhd[n].ToLower()) == -1)
{
cnt = cnt + 1;
}
}
else
{
if (fullclmhd[n].ToLower().IndexOf(tmpc.ToLower()) == -1)
{
cnt = cnt + 1;
}
}
}
}
if (fullclmhd.Length == cnt)
{
// debugger;
for (var k = 0; k < lnkwrd.Count; k++)
{
if (tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString()) != -1)
{
if (k == 0)
{
if (tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString()) == tempclm[l].ToString().ToLower().IndexOf(" comprising"))
{
lnkwrd[0] = " comprising";
}
}
if (k == 0)
{
if (tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString()) == tempclm[l].ToString().ToLower().IndexOf(" comprises"))
{
lnkwrd[0] = " comprises";
}
}
if (k == 0)
{
if (tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString()) == tempclm[l].ToString().ToLower().IndexOf(" comprises of"))
{
lnkwrd[0] = " comprises of";
}
}
if (k == 1)
{
if (tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString()) == tempclm[l].ToString().ToLower().IndexOf(" including"))
{
lnkwrd[1] = " including";
}
}
if (k == 1)
{
if (tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString()) == tempclm[l].ToString().ToLower().IndexOf(" includes"))
{
lnkwrd[1] = " includes";
}
}
if (k == 2)
{
if (tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString()) == tempclm[l].ToString().ToLower().IndexOf(" consisting of"))
{
lnkwrd[2] = " consisting of";
}
}
if (k == 2)
{
if (tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString()) == tempclm[l].ToString().ToLower().IndexOf(" consists"))
{
lnkwrd[2] = " consists";
}
}
if (k == 2)
{
if (tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString()) == tempclm[l].ToString().ToLower().IndexOf(" composed of"))
{
lnkwrd[2] = " composed of";
}
}
if (min1 > tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString()))
{
min1 = tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString());
tempclmhdful = tempclm[l].ToString().Substring(0, tempclm[l].ToString().ToLower().IndexOf(lnkwrd[k].ToString()));
// novValhdRem = novVal.Substring(novVal.ToLower().IndexOf(lnkwrd[k]) + lnkwrd[k].Length - 1, novVal.Length);
// novValhdRem = novValhdRem.Substring(novValhdRem.IndexOf(" "), novValhdRem.Length);
//
}
}
}
if (tempclmhdful == "")
{
if (tempclm[l].ToString().ToLower().IndexOf(",") != -1)
{
tempclmhdful = tempclm[l].ToString().Substring(0, tempclm[l].ToString().ToLower().IndexOf(","));
// novValhdRem = novVal.Substring(tempclm[l].ToString().ToLower().IndexOf(",") + ",".Length - 1, novVal.Length);
}
}
// debugger;
if (tempclmhdful.ToLower().IndexOf("according to claim") != -1)
{
tempclmhdful = tempclmhdful.Substring(0, tempclmhdful.ToLower().IndexOf("according to claim"));
}
else if (tempclmhdful.ToLower().IndexOf("any said claim") != -1)
{
tempclmhdful = tempclmhdful.Substring(0, tempclmhdful.ToLower().IndexOf("any said claim"));
}
else if (tempclmhdful.ToLower().IndexOf("as per claim") != -1)
{
tempclmhdful = tempclmhdful.Substring(0, tempclmhdful.ToLower().IndexOf("as per claim"));
}
else if (tempclmhdful.ToLower().IndexOf("of claim") != -1)
{
tempclmhdful = tempclmhdful.Substring(0, tempclmhdful.ToLower().IndexOf("of claim"));
}
clmcnt = clmcnt + 1;
// debugger;
string[] tempclmhdsplt = tempclmhdful.Split(' ');
if (tempclmhdsplt.Length > 5)
{
tempclmhd = tempclmhdsplt[0] + " " + tempclmhdsplt[1] + " " + tempclmhdsplt[2] + " " + tempclmhdsplt[3] + " " + tempclmhdsplt[4];
}
else
{
tempclmhd = tempclmhdful.Trim();
}
if (tempclmhdful != "")
{
if (clmbool != true)
{
claimhdrem = claimhdrem + "|" + tempclmhdful.Trim();
}
else
{
claimhdrem = tempclmhdful.Trim();
clmbool = false;
}
}
if (tempclmhd != "")
{
claimhd = claimhd + "|" + tempclmhd;
}
}
}
else
{
tempclm[l] = "";
} //-------
}
}
// debugger;
//splitDDSC(claimhdrem);
//if (absplus.ToLower().IndexOf("technical field") != -1 || absplus.ToLower().IndexOf("the technical field") != -1 || absplus.ToLower().IndexOf("the technical field of") != -1) {
// absplus = absplus.replace(/the technical field of/gi, "");
// absplus = absplus.replace(/the technical field/gi, "");
// absplus = absplus.replace(/technical field/gi, "");
//}
absplus = Regex.Replace(absplus, @"(the)?\stechnical\sfield\s(of)?", "", RegexOptions.IgnoreCase);
string fulluse = claimhdful.Trim();
claimhdrem = claimhdrem.Replace("|", " $$$$ ");
fulluse = Regex.Replace(fulluse, @"\sthe\scharacter\sis\s*(:|that)\s*(it)*\s*", " ", RegexOptions.IgnoreCase);
fulluse = fulluse.Trim();
fulluse = fulluse.TrimEnd(',');
if (absplus != "")
{
fulluse = fulluse + " $$ " + absplus.Trim();
}
if (claimhdrem != "")
{
fulluse = fulluse + " $$ " + claimhdrem.Trim();
}
while (fulluse.Substring(fulluse.Length - 1, 1) == " " || fulluse.Substring(fulluse.Length - 1, 1) == "$")
{
fulluse = fulluse.Substring(0, fulluse.Length - 1);
}
fulluse = fulluse.Replace(" $$ $$ ", " $$ ");
fulluse = fulluse.Trim();
//debugger;
// if (clmcnt == 1) {
// fulluse = fulluse + ' (claimed)';
// }
// else if (clmcnt > 1) {
// fulluse = fulluse + ' (all claimed)';
// }
//fulluse = fntable(8, fulluse);
if (canVal.IndexOf("$$") != -1)
{
canVal = canVal.Trim();
canVal = canVal.Substring(canVal.IndexOf("$$") + 2, canVal.Length - (canVal.IndexOf("$$") + 2));
canVal = canVal.Trim();
}
// debugger;
// canVal="asjdbasbasbasbasbc";
if (canVal.Length > 0)
{
canVal = canVal.Substring(0, 1).ToUpper() + canVal.Substring(1, canVal.Length - 1);
}
if (fulluse.Length > 0)
{
fulluse = fulluse.Substring(0, 1).ToUpper() + fulluse.Substring(1, fulluse.Length - 1);
}
return fulluse;
}
protected string splitTitleT(string novVal, string fulluse)
{
novVal = Regex.Replace(novVal, @"\((.*?)\)", "", RegexOptions.None);
// debugger;
string sPart = "";
while (novVal.IndexOf("<TM>") != -1 && novVal.IndexOf("</TM>") != -1)
{
sPart = "";
int firstVal = novVal.IndexOf("<TM>");
if (novVal.IndexOf("(RTM:") != -1 && novVal.IndexOf(")") != -1)
{
int secondVal = novVal.IndexOf("(RTM:") + 5;
sPart = novVal.Substring(secondVal, novVal.Length - secondVal);
novVal = novVal.Substring(0, firstVal) + " " + sPart.Substring(sPart.IndexOf(")") + 1, sPart.Length - (sPart.IndexOf(")") + 1));
}
else
{
novVal = novVal.Substring(0, firstVal) + " " + novVal.Substring(novVal.IndexOf("</TM>") + 5, novVal.Length - (novVal.IndexOf("</TM>") + 5));
}
}
novVal = novVal.Replace("<CITO>", "").Replace("<\\CITO>", "");
string ttVal = "";
if (novVal.ToLower().IndexOf(" has ") != -1 && novVal.ToLower().IndexOf(" involves ") == -1)
{
ttVal = "$$ has $$";
}
else if (novVal.ToLower().IndexOf(" has ") == -1 && novVal.ToLower().IndexOf(" involves ") != -1)
{
ttVal = "$$ involves $$";
}
else if (novVal.ToLower().IndexOf(" has ") != -1 && novVal.ToLower().IndexOf(" involves ") != -1)
{
if (novVal.ToLower().IndexOf(" has ") < novVal.ToLower().IndexOf(" involves "))
{
ttVal = "$$ has $$";
}
else
{
ttVal = "$$ involves $$";
}
}
// novValsplit = novVal.replace(/[;,.]/gi, "|");
// var tempn = new Array();
// tempn = novValsplit.split("|");
// debugger;
if (novVal.IndexOf("$$") != -1)
{
novVal = novVal.Substring(0, novVal.IndexOf("$$")).Trim();
}
if (novVal.ToLower().IndexOf(" has ") != -1)
{
novVal = novVal.Substring(novVal.IndexOf(" has ") + " has ".Length, novVal.Length - (novVal.IndexOf(" has ") + " has ".Length));
}
else if (novVal.ToLower().IndexOf(" involves ") != -1)
{
novVal = novVal.Substring(novVal.IndexOf(" involves ") + " involves ".Length, novVal.Length - (novVal.IndexOf(" involves ") + " involves ".Length));
}
// if (novVal.length < 301) {
// novValPart = novVal;
// }
// else {
// fPart = novVal.substring(0, novVal.length - 300);
// sPart = novVal.substring(novVal.length - 300, novVal.length);
// fPart = fPart.replace(/[;,.]/gi, "|");
// fPart = fPart.substring(fPart.lastIndexOf("|") + 1, fPart.length);
// novValPart = fPart + sPart;
// novValPart = trim(novValPart);
// }
// ttVal = fulluse + " " + ttVal + " " + novValPart;
ttVal = fulluse + " " + ttVal + " " + novVal;
ttVal = ttVal.Trim();
ttVal = ttVal.TrimEnd('.');
ttVal = Regex.Replace(ttVal, @"\s(a|an|the|said)\s", " ", RegexOptions.None);
ttVal = Regex.Replace(ttVal, @"\s(a plurality of|whereby|therein|substantially|kind of|characterized by above mentioned)\s", " ", RegexOptions.IgnoreCase);
ttVal = Regex.Replace(ttVal, @"\sby means of\s", "by", RegexOptions.IgnoreCase);
ttVal = Regex.Replace(ttVal, @"\smeans\s", "unit", RegexOptions.IgnoreCase);
ttVal = Regex.Replace(ttVal, @"\s(thereby|therefore)\s", "so that", RegexOptions.IgnoreCase);
ttVal = Regex.Replace(ttVal, @"\smember\s", "unit", RegexOptions.IgnoreCase);
ttVal = Regex.Replace(ttVal, @"\s+", " ", RegexOptions.None);
ttVal = Regex.Replace(ttVal, @"\$\$\swherein(\shas)?", " ", RegexOptions.None);
ttVal = Regex.Replace(ttVal, @"\s+", " ", RegexOptions.None);
ttVal = " " + ttVal + " ";
ttVal = Regex.Replace(ttVal, @"\s(a|an|the|said)\s", " ", RegexOptions.None);
ttVal = Regex.Replace(ttVal, @"\s+", " ", RegexOptions.None);
ttVal = ttVal.Trim();
ttVal = ttVal.Replace("$$ has $$", ", has <br><br>").Replace("$$ involves $$", ", involves <br><br>");
return ttVal.ToString();
}
}
}
No comments:
Post a Comment