Serendipity

1

votes
1

answer
39

views

Getting Data from multiple a tags in HTML

I am scraping a medical website where I need to extract header wise information regarding a drug e.g Precautions, Contraindications,Dosage, Uses etc. The HTML data looks like below. If I just extract info using the tag p.drug-content I get content under all the headers as one big paragraph. How do I...
serendipity
1

votes
1

answer
1.3k

views

CUDA_npp_LIBRARY error with cmake 2.8 and CUDA v 5.5

I am trying to build a solution in Visual Studio 2010 and to do so had to setup cmake 2.8, opencv and CUDA v5.5 for supporting files. While doing a cmake build I get the following error. CMake Error: The following variables are used in this project, but they are set to NOTFOUND.Please set...
serendipity
1

votes
1

answer
374

views

Check if a word in a string is contained in a set

I have a set called namePrefixSuffixSet which has possible prefix and suffix information. E.g Jr, Mr., Mrs., Attorney General etc. I am extracting proper nouns from a sentence and checking them against this set to see if the proper noun contains a prefix or a suffix. If it does then I classify this...
serendipity
1

votes
1

answer
5.7k

views

value map is not a member of org.apache.spark.sql.Row

I have tweets from Twitter in the complex schema and I am trying to extract text from those tweets and then clean the data for doing further analysis. I am running an SQL query to extract tweets and then when I tried to use replaceAll or replace to clean the tweets it kept throwing an exception va...
serendipity
1

votes
2

answer
69

views

Best way to read text from file line by line when the text may contain '^M' with Python

I am reading a tab delimited text file, where each row is ended with a new line. I have a problem of newlines inside quoted sections (this text is inserted by humans and may contain new lines within a row). For example: 'Great feeling! Totally recommend it! Super comfort and it lasts!' Which is bas...
Serendipity
1

votes
1

answer
1.1k

views

Spacy NLP - Chunking with Regular Expressions

Spacy includes the noun_chunks functionality to retrieve set of Noun -Phrases. The function english_noun_chunks (attached below) uses word.pos == NOUN def english_noun_chunks(doc): labels = ['nsubj', 'dobj', 'nsubjpass', 'pcomp', 'pobj', 'attr', 'root'] np_deps = [doc.vocab.strings[label] for label...
Serendipity
1

votes
1

answer
511

views

Partial string match

I am comparing two values of two different maps and looking for exact and partial matches. I am checking for partial matches using val1.contains(val2) but get a false. An example of strings I am matching is: val1: Kansas City Athletics val2: Athletics why does the contains() method not work in thi...
serendipity
1

votes
1

answer
353

views

Guice Assisted Inject with Providers or FactoryModuleBuilder

This is kind of a weird use-case and I need some help in figuring out how to use Assisted/Providers/FactoryModuleBuilders in conjunction with each other. Ignore the absence of @Singleton. This is just an example. A set of traits belonging to a library I cannot change have the following pattern. It u...
Serendipity
1

votes
1

answer
2k

views

Python - The best way to read a sparse file into a sparse matrix

Would like to know if there is a more efficient way to load file content into a sparse matrix. The following code reads from a big file (8GB), which has mostly zero values (very sparse), and then does some processing on each line read. I would like to perform arithmetic operations on it efficientl...
Serendipity
1

votes
3

answer
1.8k

views

TypeError: a float is required in sklearn.feature_extraction.FeatureHasher

I'm using sklearn version 0.16.1. It seems that FeatureHasher doesn't support strings (as DictVectorizer does). For example: values = [ {'city': 'Dubai', 'temperature': 33.}, {'city': 'London', 'temperature': 12.}, {'city': 'San Fransisco', 'temperature': 18.} ] print('Starting FeatureHasher ...')...
Serendipity
1

votes
2

answer
909

views

Hashmap with multiple keys and values?

I want to create a HashMap that looks like this: {LOCATION =[China,Sydney, New York,...], NAME = [Bob Smith, Martha Stewart, Amanda Holmes,....], ORGANIZATION = [Matrix Inc, Paragon Pharmaceuticals, Wills Corp.,...]} I have more than 1 key with multiple values. Whats the best way to do this?
serendipity
1

votes
3

answer
719

views

Compare two dictionaries with one key in common and form a new dictionary combining the remaining keys associated with this common key

I have two dictionaries, one contains the name and initial values of some registers and the other contains the name and address values of those same registers. I need to compare the two dictionaries on register names [id] and then take the initial value of a register [initValue] from dictionary 1 an...
serendipity
4

votes
1

answer
209

views

Looking for punctuations marks in a string and then finding their index to do a substring

I have some string where I need to extract a substring from it based on either the first occurrence of a punctuation mark or the first occurrence of a digit. E.g from Taltz 80mg autoinjector I need to extract Taltz or from Trulicity 0.75mg, weekly I need to extract Trulicity Here's my code: char []...
serendipity
4

votes
2

answer
3k

views

Trying to automate the fpga build process in Xilinx using python scripts

I want to automate the entire process of creating ngs,bit and mcs files in xilinx and have these files be automatically be associated with certain folders in the svn repository. What I need to know is that is there a log file that gets created in the back end of the Xilinx gui which records all the...
serendipity
2

votes
1

answer
1.1k

views

JQuery UI Custom Tabs that need to fit horizontal space

JQuery UI Tabs are stacked left and do not fill the horizontal space. Perhaps this is too much to ask, but here it goes: Consider the following markup ...content... ...content... ...content... By default table cells expand to fit the horizontal space available. So, if the tabs were designed as tabl...
Serendipity
2

votes
4

answer
1.3k

views

Python script to calculate the time between 2 successive packets received over the serial port

I am debugging my code for which I need to write a python script that can read data being sent over the serial port through bluetooth and calculate the time elapsed between each successive packet.I know how to read the data from the serial port but I am having issues with calculating the time betwee...
serendipity
3

votes
1

answer
562

views

NSLinguisticTagger Memory Leak

I've been fiddling in Xcode 4.2 with iOS 5.0's new NSLinguisticTagger. My objective with this function is to take in an address book record and then spit out a composite name as an NSString, sort of like what ABRecordCopyCompositeName does, but taking into account naming order for East Asian languag...
Serendipity
2

votes
2

answer
3k

views

Getting a jar does not exist and java.lang.ClassNotFoundException while running a simple twitter sentiment analysis code

I have been struggling with this for some time now. I have been trying to run a simple twitter sentiment analysis code which seemed to work fine earlier but doesn't work anymore. I am using spark 1.3.1 with scala 2.10.4. I read somewhere that TwitterUtils doesn't work with spark 1.0+ so I tried a wo...
serendipity
1

votes
3

answer
348

views

Getting output in the desired format using TokenRegex

I am using TokensRegex for rule based entity extraction. It works well but I am having trouble getting my output in the desired format. The following snippet of code gives me an output given below for the sentence: Earlier this month Trump targeted Toyota, threatening to impose a hefty fee on the w...
serendipity
2

votes
3

answer
189

views

Splitting lines in a file into string and hex and do operations on the hex values

I have a large file with several lines as given below.I want to read in only those lines which have the _INIT pattern in them and then strip off the _INIT from the name and only save the OSD_MODE_15_H part in a variable. Then I need to read the corresponding hex value, 8'h00 in this case, ans strip...
serendipity
2

votes
0

answer
327

views

Maven Project Organization

I am trying to create module within an existing multi-module maven project. This module will require Grunt, Bower, NPM, Angular JS, bootstrap among others. The output of this project (after the build is done) are static resources (fonts, js-files, application-js, application-css). There is a separat...
Serendipity
2

votes
0

answer
156

views

Trying to explore connected shop floor use case and need advice on an IOT architecture

Apologies if this question ends up being very general and broad. IoT is new and upcoming with people still trying to figure it out so I decided to take a chance and ask my question. I looked at the legacy and current applications being used on the shop floor and reached an understanding that at the...
serendipity
3

votes
1

answer
1.2k

views

AES 128 DOT NET and Java Compatibility

We have been trying a prototype of a scheme where we encrypt decrypt data between two systems: One in .NET and the other in Java. We were going to use simple 128 bit AES Encryption. The problem I am facing is trivial, but I cannot find a proper solution. Maybe my understanding of AES or Encryption i...
Serendipity
2

votes
1

answer
25

views

Extracting multiple strings from a sentence that has been passed through the Stanford NER tagger

I wrote code to extract multiple patterns from my string which has passed through a Stanford NER parser and gives output like: Input Sentence - Goldman profit at risk under Volcker rule Output Sentence - Goldman profit at risk under Volcker rule I need to extract the word Volker and put it in perso...
serendipity
3

votes
1

answer
307

views

Localizing ABAddressBook

I have an address book-based app where I grab the contacts name and display them in a table, just like ABPeopleViewController, using NSString *name = (NSString *)ABRecordCopyCompositeName([contacts objectAtIndex:indexPath.section]); aCell.textLabel.text = name; [name release]; That works fine when...
Serendipity
5

votes
3

answer
1.9k

views

Memory Leak in iOS KeychainItemWrapper

I'm using the KeyChainItemWrapper from Apple's sample code to store user password for authentication, but when I call it to set the password: [keychain setObject:passwordField.text forKey:(id)kSecValueData]; It dribbles memory leaks all over my shirt. The problem apparently traces back to line 274 i...
Serendipity
2

votes
1

answer
1.2k

views

Logistic Regression in Spark for predictive analysis

I am a beginner in spark,big data and scala, I am trying to build a predictive model in Spark with a sample data-set. I wanted to use pySpark but currently mllib for pyspark has limitations as it doesn't do save and load. I have a couple of questions: My data is in csv format and looks like this: B...
serendipity
4

votes
1

answer
3.2k

views

Using VCards with ABAddressBook in iOS 5.0/XCode 4.2

I am trying to save a copy of all the entries in the address book, save it to a file as vcards, and then retrieve that file (or a version of that file) and add them back to the address book when I need them, in a backing up context. I know this question has been asked before, but for the life of me...
Serendipity
2

votes
2

answer
109

views

How do I iterate over a LinkedHashMap of LinkedHashMaps?

My map looks like this : LinkedHashMap leftRightWords Where the first map contains left words of a proper noun and second map contains right words of a proper noun. E.g. in : 'Following the Rhode Island solution provider Atrion's decision to sell' map1 will have entries like: Rhode Island, Follow...
serendipity
2

votes
0

answer
818

views

Saving twitter streams into a single file with spark streaming, scala

So after help from this answer Spark Streaming : Join Dstream batches into single output Folder I was able to create a single file for my twitter streams. However,now I don't see any tweets being saved in this file. Please find below my code snippet for this. What am I doing wrong? val ssc = new Str...
serendipity
2

votes
0

answer
220

views

Comparing two maps to calculate precision and recall for NER

I am trying to calculate precision and recall for our Named Entity Recognizer by comparing our output to a gold set output. annotationMap is the gold set map and myMap is the output of my NER.To give you a sense, the maps contain data like: {ORGANIZATION=[Pearl Williams Hartsfield, Fulton Superior C...
serendipity
2

votes
1

answer
635

views

TokensRegex rules to get correct output for Named Entities

I was finally able to get my TokensRegex code to give some kind of output for named entities. But the output is not exactly what I want. I believe the rules need some tweaking. Here's the code: public static void main(String[] args) { String rulesFile = 'D:\\Workspace\\resource\\NERRulesFile.rules...
serendipity
1

votes
1

answer
2.7k

views

How to download packages, Programming R

I have no idea how to open the file of the packages on programming R. For instance, when I download one of the Windows binaries of rgl from http://cran.r-project.org/web/packages/rgl/index.htm and I select R file of the downloaded zip file,using programming R, it does not work. How can I fix this p...
Serendipity
2

votes
0

answer
36

views

Tokensregex rules to identify quantities not working correctly

I'm encountering a strange problem. I am using Tokensregex to identify Quantities from text and for the most part it's working well, however, in the sentence given below it fails to identify 1.2 million as a quantity whereas the same rule works for 2.4 million. I've tried everything..I'm a little st...
serendipity
4

votes
1

answer
1.2k

views

Spark2 - LogisticRegression training finished but the result is not converged because: line search failed

While training a Logistic Regression classifier I get the following error: 2016-08-16 20:50:23,833 ERROR [main] optimize.LBFGS (Logger.scala:error(27)) - Failure! Resetting history: breeze.optimize.FirstOrderException: Line search zoom failed 2016-08-16 20:50:24,009 INFO [main] optimize.StrongWolfe...
Serendipity
3

votes
2

answer
1.3k

views

Creating a virtualenv with Anaconda's Python version

An error when creating a virtualenv which uses a Python version different than the default Python of the machine, while Anaconda is installed on the machine. I created a new virtual environment: virtualenv --no-site-packages ~/graphlabcreate source ~/graphlabcreate/bin/activate That created a direc...
Serendipity
3

votes
1

answer
639

views

Dynamic Configuration in Angular JS

I was creating a directive to display a chart. I went through the usual templates of creating a module, with a directive. For configuration, I decided to use a Provider. I understood how I could have the application set up my module's configuration through the provider. However, one use case that I...
Serendipity
2

votes
1

answer
235

views

Importing an xml schema into postgres to automatically create a table and then populate it with an xml file?

I have a huge xml file that I cannot open unless I import it into a database. I am using Postgres for this. I have a schema that goes with this data file. There are too many columns so i'd like to automate the process of creating a table from this schema and then importing the data file from the loc...
serendipity
2

votes
2

answer
46

views

Locking vs. Updating Directly

I have declared an enum and this is what it looks like (not real code) public enum MySession { INSTANCE; MySession() { loadFactory(); } public void refreshMyFactory() { //Is it OK to call 'loadFactory' here as-is, or should I worry about concurrency } private void loadFactory() { MyFactory factory =...
Serendipity
2

votes
0

answer
450

views

NGINX 1.6.2 reverse proxy for multiple web servers with different context

I have 2 seperate java web (apple & banana) applications running in 2 seperate Tomcat servlet containers on the same physical Linux server: http://localhost:8080 http://localhost:8085 I'd like to use NGINX to act as a reverse proxy and forward the SSL encrypted HTTP traffic to its respective Tomcat...
Missi Serendipity

View additional