Search Results

Search found 36172 results on 1447 pages for 'unicode string'.

Page 87/1447 | < Previous Page | 83 84 85 86 87 88 89 90 91 92 93 94  | Next Page >

  • Complex string matching with fuzzywuzzy

    - by That1Guy
    I'm attempting to write a process that matches obscure strings to a single 'master string' for further processing. I have a lot of data that looks something like this: Basketball Basket Ball Football BasketBallR BBall BBall - r FootB ...and so on. These need to be mapped to a master record like so: Basketball = Basket Ball, BBall Basketball - R = BasketBallR, BBall - r I also have instances of data resembling this format: Football -r FootBall - r-g/H,Q,HH These situations need to be separated into different categories before being mapped. For example FootBall - r-g/H,Q,HH should be: Football - r Football - g Football - H Football - Q Football - HH At this point, it still needs to be mapped to a master record... I've tried several different combinations of fuzzywuzzy matching methods, Levenshtein Distance measurements, regex, etc. and can't seem to find a reliable method to logically associate different naming styles of a single item with a master name. I'm throwing my hands up in desperation. Are there any existing python resources than can help sort out my problem? Are there other options? Can anybody point out an obvious option that I might have overlooked? Basically, any suggestion, solution, resource or alternative method is greatly appreciated.

    Read the article

  • String on a model

    - by alecnash
    I am trying to put a sting on a Model and I want it to be dynamic. Did some research and came up with drawing the text on the texture and then set it on the model. I use something like this: public static Texture2D SpriteFontTextToTexture(SpriteFont font, string text, Color backgroundColor, Color textColor) { Size = font.MeasureString(text); RenderTarget2D renderTarget = new RenderTarget2D(GraphicsDevice, (int)Size.X, (int)Size.Y); GraphicsDevice.SetRenderTarget(renderTarget); GraphicsDevice.Clear(Color.Transparent); Spritbatch.Begin(); //have to redo the ColorTexture Spritbatch.Draw(ColorTexture.Create(GraphicsDevice, 1024, 1024, backgroundColor), Vector2.Zero, Color.White); Spritbatch.DrawString(font, text, Vector2.Zero, textColor); Spritbatch.End(); GraphicsDevice.SetRenderTarget(null); return renderTarget; } When I was working with primitives and not models everything worked fine because I set the texture exactly where I wanted but with the model (RoundedRect 3d button) it looks like that: Is there a way to have the text centered only on one side?

    Read the article

  • Use iconv API in C

    - by Constantin
    I try to convert a sjis string to utf-8 using the iconv API. I compiled it already succesfully, but the output isn't what I expected. My code: void convertUtf8ToSjis(char* utf8, char* sjis){ iconv_t icd; int index = 0; char *p_src, *p_dst; size_t n_src, n_dst; icd = iconv_open("Shift_JIS", "UTF-8"); int c; p_src = utf8; p_dst = sjis; n_src = strlen(utf8); n_dst = 32; // my sjis string size iconv(icd, &p_src, &n_src, &p_dst, &n_dst); iconv_close(icd); } I got only random numbers. Any ideas? Edit: My input is char utf8[] = "\xe4\xba\x9c"; //? And output should be: 0x88 0x9F But is in fact: 0x30 0x00 0x00 0x31 0x00 ...

    Read the article

  • reading non-english html pages with c#

    - by Gal Miller
    I am trying to find a string in Hebrew in a website. The reading code is attached. Afterward I try to read the file using streamReader but I can't match strings in other languages. what am I suppose to do? // used on each read operation byte[] buf = new byte[8192]; // prepare the web page we will be asking for HttpWebRequest request = (HttpWebRequest) WebRequest.Create("http://www.webPage.co.il"); // execute the request HttpWebResponse response = (HttpWebResponse) request.GetResponse(); // we will read data via the response stream Stream resStream = response.GetResponseStream(); string tempString = null; int count = 0; FileStream fileDump = new FileStream(@"c:\dump.txt", FileMode.Create); do { count = resStream.Read(buf, 0, buf.Length); fileDump.Write(buf, 0, buf.Length); } while (count > 0); // any more data to read? fileDump.Close();

    Read the article

  • StreamReader.ReadToEnd() returning an empty string

    - by axk
    I have a method private static String DecompressAndDecode(byte[] data) { GZipStream decompressor = new GZipStream(new MemoryStream(data), CompressionMode.Decompress); StreamReader decompressed = new StreamReader(decompressor, Encoding.UTF8); String result = decompressed.ReadToEnd(); return result; } I have some GZipped text as input and the result is supposed to be a String representation of this text. The problem is that the method returns an empty string. What is puzzling me is that when I step trough the method in debug mode and reach the return statement the result variable is an empty string but if I create a watch for the decompressed.ReadToEnd() expression it returns me the text. What I would expect at this point is the result variable to contain the text and the decompressed.ReadToEnd() expression evaluating to an empty string. (Reevaluating the decompressed.ReadToEnd() expression returns an empty string as expected). There must be something obvious I'm missing here.

    Read the article

  • StremReader.ReadToEnd() returning an empty string

    - by axk
    I have a method private static String DecompressAndDecode(byte[] data) { GZipStream decompressor = new GZipStream(new MemoryStream(data), CompressionMode.Decompress); StreamReader decompressed = new StreamReader(decompressor, Encoding.UTF8); String result = decompressed.ReadToEnd(); return result; } I have some GZipped text as input and the result is supposed to be a String representation of this text. The problem is that the method returns an empty string. What is puzzling me is that when I step trough the method in debug mode and reach the return statement the result variable is an empty string but if I create a watch for the decompressed.ReadToEnd() expression it returns me the text. What I would expect at this point is the result variable to contain the text and the decompressed.ReadToEnd() expression evaluating to an empty string. (Reevaluating the decompressed.ReadToEnd() expression returns an empty string as expected). There must be something obvious I'm missing here.

    Read the article

  • Write a program that allows the user to enter a string and then prints the letters of the String sep

    - by WM
    The output is always a String, for example H,E,L,L,O,. How could I limit the commas? I want the commas only between letters, for example H,E,L,L,O. import java.util.Scanner; import java.lang.String; public class forLoop { public static void main(String[] args) { Scanner Scan = new Scanner(System.in); System.out.print("Enter a string: "); String Str1 = Scan.next(); String newString=""; String Str2 =""; for (int i=0; i < Str1.length(); i++) { newString = Str1.charAt(i) + ","; Str2 = Str2 + newString; } System.out.print(Str2); } }

    Read the article

  • How can I clip strings in Java2D and add ... in the end?

    - by Jonas
    I'm trying to print Invoices in a Java Swing applications. I do that by extending Printable and implement the method public int print(Graphics g, PageFormat pf, int page). I would like to draw strings in columns, and when the string is to long I want to clip it and let it end with "...". How can I measure the string and clip it at the right position? Some of my code: Font headline = new Font("Times New Roman", Font.BOLD, 14); g2d.setFont(headline); FontMetrics metrics = g2d.getFontMetrics(headline); g2d.drawString(myString, 0, 20); I.e How can I limit myString to be max 120px? I could use metrics.stringWidth(myString), but I don't get the position where I have to clip the string. Expected results could be: A longer string that exc... A shorter string. Another long string, but OK

    Read the article

  • String handle in C#

    - by Chelsea_cole
    I don't understand the use of "get" and "set" command, how to add a list of the accounts using the code below and someone give me some example to fix the error? Thanks! :( public class Account { public string UserName {get rerurn textBox1.Test; // error set UserName = textBox1.Text;} // error public string Password { get; set; } public string RePassword { get; set; } public string Name { get; set; } public string bd { get; set; } public string dt { get; set; } public string dc { get; set; } } public class ListAcc { static void Data() { List<Account> UserList = new List<Account>(); } }

    Read the article

  • Function for averages of tuples in a dictionary

    - by Billy Mann
    I have a string, dictionary in the form: ('the head', {'exploded': (3.5, 1.0), 'the': (5.0, 1.0), "puppy's": (9.0, 1.0), 'head': (6.0, 1.0)}) Each parentheses is a tuple which corresponds to (score, standard deviation). I'm taking the average of just the first integer in each tuple. I've tried this: def score(string, d): for word in d: (score, std) = d[word] d[word]=float(score),float(std) if word in string: word = string.lower() number = len(string) return sum([v[0] for v in d.values()]) / float(len(d)) if len(string) == 0: return 0 When I run: print score('the head', {'exploded': (3.5, 1.0), 'the': (5.0, 1.0), "puppy's": (9.0, 1.0), 'head': (6.0, 1.0)}) I should get 5.5 but instead I'm getting 5.875. Can't figure out what in my function is not allowing me to get the correct answer.

    Read the article

  • Convert Java String to Array

    - by Bruce
    This is a weird problem. Here is my code String reply = listen.executeUrl("http://localhost:8080/JavaBridge/reply.php); executeUrl returns as String object whatever is returned by the reply.php file. Now comes the problem. In reply.php I am returning an PHP array and reply is a String. When I do System.out.println("Reply = "+reply); I get Reply = array(2) { [0]=> string(14) "Dushyant Arora" [1]=> string(19 ) "@dushyantarora13 hi"} But reply is still a String. How do I convert it into a String array or an Array.

    Read the article

  • Passing variable string to create arrays (Android)

    - by dweebsonduty
    Hello all, I am a newb to Android and Java and want to write a funtion that will display a list based on a varable that I pass to the function. The function is below and the code below creates an array out of a string called type, but what I want to do is pass it a variable string and have it build a list based on that string. So if I wanted the type list I would say list_it("type") But if I try something like getResources().getStringArray(R.array.thelist); it doesn't work. Can someone point me in the right direction? public void list_it(String thelist){ String[] types = getResources().getStringArray(R.array.type); ArrayAdapter<String> mAdapter = new ArrayAdapter<String>(this, R.layout.list_item1, types); setListAdapter(mAdapter); ListView lv = getListView(); lv.setTextFilterEnabled(true); }

    Read the article

  • C# sqlite query results to list<string>

    - by jakesankey
    Guys, I'm struggling. I have query against my db that returns a single column of data and I need to set it as List. Here is what I am working with and I am getting an error about converting void to string. public static void GetImportedFileList() { using (SQLiteConnection connect = new SQLiteConnection(@"Data Source=C:\Documents and Settings\js91162\Desktop\CMMData.db3")) { connect.Open(); using (SQLiteCommand fmd = connect.CreateCommand()) { SQLiteCommand sqlComm = new SQLiteCommand(@"SELECT DISTINCT FileName FROM Import"); SQLiteDataReader r = sqlComm.ExecuteReader(); while (r.Read()) { string FileNames = (string)r["FileName"]; List<string> ImportedFiles = new List<string>(); } connect.Close(); } } } THEN LATER IN THE APPLICATION List<string> ImportedFiles = GetImportedFileList() // Method that gets the list of files from the db foreach (string file in files.Where(fl => !ImportedFiles.Contains(fl)))

    Read the article

  • Casting Class into String and Vice Versa in JAVA

    - by topgun_ivard
    I have a program in which I need to store a Class object into memory by casting it into String. Is it possible to convert the String back into the original Class so that I can use that class variables? I am doing this in JAVA. Example: test.java class hello{ public String h1; public String h2; } public class test { public static void main(String[] args) { hello h = new hello(); h.h1 = "hello"; h.h2 = "world"; String s = h.toString(); System.out.println("Print s : "+s); // Now I need to convert String s into type hello so that // I can do this: // (hello)s.h1; // (hello)s.h2; } } NOTE: this is not a homework, this is a personal project and I would be grateful if anyone can help! Thanks! Ivar

    Read the article

  • Fortran - String with unknown characters into substrings

    - by Masoud
    I am trying to put an input string into sub-string arrays. The number of data in the input file are less than 10 but unknown. The number of spaces between each data is also unclear. Example: Asd B Cwqe21 Ddsw Eww I am quite novice to Fortran, so I do not know which format I should use. My problem is that I do not know the number of data (here I assumed that there are 5), so how can I make the code work? I tried the following which did not work: CHARACTER (LEN=100), DIMENSION(10) :: string READ (1,*) (string,I=1,10) It seems that the error I got was because there was no 6th string to read and put into string(6). I tried using the "Index" to find the space, but since I do not know how many spaces are in the string, it did not help me.

    Read the article

  • seprate a string array to several small arrays

    - by blgnklc
    how can I separate an array in smaller arrays? string[] str = new string[145] I want two arrays for this; like string[] str1 = new string[99]; string[] str2 = new string[46]; how can I do this from the source of str? 1- Then I want to put togetger the arrays into List all together but there is only add item? no add items? or any other way to make the string[145] array again..

    Read the article

  • Splitting html string after so many words

    - by jimbo
    Hi all, I have a string that if it is longer than lets say 10 words, I want to split it into two parts. The second part will be included else-where after a 'more' link. The string will hold html tags too though. For an example the string could be: <p>This is just a test string with more words than the <strong>amount allow</strong> before split, blah blah blah</p> So in the case I would want: $string[0] // <p>This is just a test string with more words than</p>; $string[1] // <p>the <strong>amount allow</strong> before split, blah blah blah</p>; Thanks in advance

    Read the article

  • how can I enter character "<" in strings.xml?

    - by yrajabi
    I want to enter string " -< " in strings.xml file, the string has character < and I couldn't add it to xml file without error! I even tried to escaping by \ character: <string name="search_target_arrow"> -\< </string> or enclosing it between "" as below: <string name="search_target_arrow">" -< "</string> but none worked. Maybe I'm very amateur at this and the answer is not hard for you. so please tell me how you add such special chars in strings.xml?

    Read the article

  • Only strip commas surrounded by numbers in a string

    - by overlook77
    I am using StreamReader to read each line of a CSV file into a string. As I am processing each line, I need to strip out any commas that ONLY are surrounded by other numbers. For example, if the string was: "textfield1", "textfield2", "100.00", "1,070.00" I would need to only take the comma out of "1,070.00" from this entire string, resulting in: "textfield1", "textfield2", "100.00", "1070.00" Each string read from the CSV file can differ in number of fields, length, etc., so I need to use something (Regular Expressions maybe?) that looks at the entire string without hardcoding a location or blanket removal of all commas. Here is the approach I have been trying: StreamReader sr = new StreamReader(strInputFile); string nextLine = sr.ReadLine(); try { while ((nextLine = sr.ReadLine()) != null) { string rawtext = nextLine.Replace("[0-9]"+","+"[0-9]" , "[0-9]"+"[0-9]"); // ....rest of code } } This obviously doesn't work because I don't understand how to do this :) I am new at C# and inexperienced in Regex, so hopefully this is relatively simple.

    Read the article

  • What is the differance between those two Strings in Java

    - by user1816808
    why when we declare string in java we can't use == to compare this string and always will turn to false while if we initialize the string from the beginning it will be true . for example : import java.util.Scanner; public class MyString { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); String s = input.nextLine(); if(s=="Hello") system.out.println("Hello"); String d = "Hello"; if(d=="Hello") system.out.println("Hello"); } } I need an explanation please ??

    Read the article

  • C# string to combobox issues

    - by Mike
    What i'm trying to do is read in a header row of a file to a combobox. Here is my code: private void button4_Click(object sender, EventArgs e) { string[] startdelim = File.ReadAllLines(textBox1.Text); int counter = 1; foreach (string delim in startdelim) { if (counter == 1) { string removedelim = delim.Replace("\"", ""); string[] lines = removedelim.IndexOf(","); foreach (string line in lines) { comboBox1.Items.Add(line); } } counter++; } for some reason it keeps telling me Error Cannot implicitly convert type 'int' to 'string[]' at string[] lines = removedelim.IndexOf(",");

    Read the article

  • Matching 'weird' characters in PHP regex

    - by Bill X
    I have some strings that need a-strippin': ÃœT: 9.996636,76.294363 Tons of long strings of location codes. A literal regex in PHP won't match them, IE $pattern = /ÃœT:/; echo preg_replace($pattern, "", $row['location']); Won't match/strip anything. (To know it's working, /T:/ does strip the last bit of that string). What's the encoding error doing on here? Alternately, I would accept a concise way to take out just the numbers.

    Read the article

  • Matching non-[a-zA-Z] characters in PHP regex

    - by Bill X
    I have some strings that need a-strippin': ÃœT: 9.996636,76.294363 Tons of long strings of location codes. A literal regex in PHP won't match them, IE $pattern = /ÃœT:/; echo preg_replace($pattern, "", $row['location']); Won't match/strip anything. (To know it's working, /T:/ does strip the last bit of that string). What's the encoding error going on here? Alternately, I would accept a concise way to take out just the numbers.

    Read the article

< Previous Page | 83 84 85 86 87 88 89 90 91 92 93 94  | Next Page >