FAQ Database Discussion Community


On signature matching of Standard ML

types,matching,sml,signature
To my understanding, a CANDIDATE signature matches a TARGET signature if CANDIDATE is stronger than TARGET. Then if structure some_structure implements signature CANDIDATE, it implements signature TARGET too. But according to page 155 of Robert Haper's Programming in Standard ML (Version 1.2 of 11.02.11): signature MERGEABLE_QUEUE = sig include QUEUE...

awk to match two fields in two files

awk,comparison,matching
I want to find lines where fields 1 and 2 from file1 match fields 2 and 3 from file2, and then print all fields from file2. There are more lines in file2 than in file1 File1 rs116801199 720381 rs138295790 16057310 rs131531 16870251 rs131546 16872281 rs140375 16873251 rs131552 16873461 File2 ---...

Java regex to match absent groups at fixed locations

java,regex,pattern-matching,group,matching
A regex is needed that always matches (with matches(), not find()) and always recognizes 3 groups, for 3 different cases of input, like 1234 ab$.5!c=:d6 efg(789) 1234 efg(567) efg(567) The pattern (?:^(\d+)\s+(\S)\s)?\s*([^\(]+\(\S+\)) represents the kind of values expected in each group (without assumptions about the location of characters), but only...

Exact matching and GenMatch in R

r,matching
So following the example from the Matching package and in particular the GenMatch example Link to pdf here Following the example here library(Matching) data(lalonde) attach(lalonde) X = cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74) BalanceMat <- cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74, I(re74*re75))...

Fuzzy matching movie titles without using a loop and extracting equivalent titles by release date

r,matching,string-matching,levenshtein-distance,fuzzy-search
I am trying to merge two data sets based on movie title column that contains movie names using fuzzy string matching. A sample from the 2 data sets are given below. The first data set looks like itemid userid rating time title release_date 99995 1677 854 3 1997-12-22 sweet nothing...

C# Find non matching values in DataTables

c#,datatable,matching,relation
I'm struggling with the following problem: There are 2 DataTables (SSFE and FE in my case). FE will contain items that match with SSFE, but it will also contain values not present in SSFE. For Example SSFE 1,2,3,4,5,6,9,10 FE 1,2,3,4,5,6,7,8,9,10,11 The ouput I need is in this example : 7,...

Find string matching id using JQuery

jquery,string,find,matching
I want to use JQuery to find the last part of this id I tried this: <input id="test-id-1234"> var f_id = $( 'input[ @id ^= 'test-id-' ]' ); alert(f_id[0].id); but it did not work....

How to find maximum number of such pairs of connected edges in a graph that each pair is separated from another pair by at least two edges?

algorithm,graph,matching
I need to find maximum number of pairs of connected edges in a graph such that each pair is separated from every other pair by at least two edges. This could be seen as the maximum matching without the constraint of covering all edges where each component in the alternating...

Print all non-matching items in Perl

regex,perl,if-statement,matching
I have a perl script that compares text from two files. The files on most days should be exactly the same, but if for some reason some of the text in the file changes I want the script to print out all the text that is not exactly the same...

Inconsistent match function, if I run twice works (R)

r,match,matching
I am trying to reorder a numeric vector current_qty using its name according to another vector trade_order. After a simple match, they give me some weird arrangement. current_qty <- getQuantity(trades) print(names(current_qty)) [1] "ivvb11" "lft20210301" "ltn20180101" "ntnb20200815" "pibb11" print(trade_order) [1] "pibb11" "ivvb11" "lft20210301" "ntnb20200815" "ltn20180101" current_qty <- current_qty[match(names(current_qty), trade_order)] print(current_qty) lft20210301...

Regex to match a simple math equation within a string

php,regex,matching
For example, if there was this string: what is 4+3, or, what is 3 * 2, or, what is 3x2, or, what is 4 times 2, how would this be accomplished? Is it possible to create such a matching system in regex?...

php preg_match_all conditional pattern

php,regex,matching,pcre
The php pattern regex syntax stuff really gives me headaches... I'm trying to match all javascript tags except the js tags with id="pagespeed", so that I can move them somewhere else. All I need is the pattern condition, everything else is done. I'm having this: $jsPattern = '#<script.*</script>#isUm'; which finds...

Draw nearest value from sorted data frame into unsorted data frame

r,matching,cumulative-frequency
I have two data frames in R. The first data frame is a cumulative frequency distribution (cumFreqDist) with associated periods. The first rows of the data frame look like this: Time cumfreq 0 0.0000000 4 0.9009009 6 1.8018018 8 7.5075075 12 23.4234234 16 39.6396396 18 53.4534535 20 58.2582583 24 75.3753754...

matlab find most similar rows in 2 matrices

matlab,matrix,matching
I have 2 matrices A = [66 1 29.2; 80 0 29.4; 80 0 29.4; 79 1 25.6]; B = [66 1 28.2; 79 0 28.4; 66 1 27.6; 80 0 22.4] I would like to find the indeces of the matching rows. indx = [1 1; 2 4; 3...

File Handling and making directories to match in bash

bash,shell,sorting,matching,file-handling
I have these files: File_1.2.txt, File_1.5.txt, File_2.3.txt, and File_4.7.txt. I want to make directories for them and sort them into the directories, like below. Dir_001 -> File_1.2.txt File_1.5.txt Dir_002 -> File_1.2.txt File_2.3.txt Dir_003 -> File_2.3.txt Dir_004 -> File_4.7.txt Dir_005 -> File_1.5.txt Dir_007 -> File_4.7.txt So a directory is made for...

How to find matching rows in Pandas DataFrame with identical values with same/opposite signs in certain columns?

python,pandas,duplicates,dataframes,matching
For the dataframe below, how can I return first and third row, as they have identical values in column "c" and "d", and have values opposite of each other in "a" and b"? df1=pd.DataFrame([ [1,2,3,4],[5,6,7,8], [-1,-2,3,4]], columns=['a', 'b', 'c', 'd']) a b c d 0 1 2 3 4 1...

Get the key for a value in my array

php,arrays,matching,username
I have an user array like this : array(3) { ["A057"] => array(7) { [0] => string(13) "KENE Michael " [1]=> string(16) "KIRAN Maria " [2]=> string(14) "ATHISA KATHISA " [3]=> string(16) "SATYA Dev " [4]=> string(16) "Raghav Laurent " [5]=> string(12) "DARTY Suneep " [6]=> string(22) "GIO Simral "...

How to collect a continuous set of webpages using python?

python,regex,url,beautifulsoup,matching
https://example.net/users/x Here, x is a number that ranges from 1 to 200000. I want to run a loop to get all the URLs and extract contents from every URL using beautiful soup. from bs4 import BeautifulSoup from urllib.request import urlopen import re content = urlopen(re.compile(r"https://example.net/users/[0-9]//")) soup = BeautifulSoup(content) Is this...

Regex to match string with hyphen sign between two numbers

php,regex,matching
For example, if there was this string: what is 4-3, how would it be accomplished in PHP to check if a number minus another number is in a string, while not misfiring in cases like you're pig-brained. Is it possible to create such a matching system in regex?...

How to use regex for matching multiple words in Java

java,regex,matching
How can I use regex to match multiple words in java? For example, the addAction("word") and intentFilter("word") at the same time for matching? I tried: string REGEX ="[\\baddAction\\b|\\bintentFilter\\b]\\s*\([\"]\\s*\\bword\\b\\s*[\"]\)"; Could someone tell me what's wrong with this format and how can I fix it?...

How to get pixel coordinates from Feature Matching

python,opencv,image-processing,matching,feature-detection
I need to get the list of the x and y coordinates of the pixels that feature matcher selects in the code provided. I'm using Python and OpenCV. Can anyone help me? img1=cv2.imread('DSC_0216.jpg',0) img2=cv2.imread('DSC_0217.jpg',0) orb=cv2.ORB(nfeatures=100000) kp1,des1=orb.detectAndCompute(img1,None) kp2,des2=orb.detectAndCompute(img2,None) img1kp=cv2.drawKeypoints(img1,kp1,color=(0,255,0),flags=0) img2kp=cv2.drawKeypoints(img2,kp2,color=(0,255,0),flags=0) cv2.imwrite('m_img1.jpg',img1kp) cv2.imwrite('m_img2.jpg',img2kp)...

How to assign identical unique IDs to matching observations between two dataframes in r?

r,matching,uniqueidentifier
I have a practical question when I have two (or more) data frames and want to assign unique IDs for each matching observation within each and across both datasets e.g.: #1. Create dataframe df1: a1 <- c(1, 1, 1, 1, 2, 2, 2, 2, 1, 1) b1 <- c(1,...

Microstrategy documents - matching differen attributes with the same value

attributes,document,matching,value,microstrategy
I'm building a document with a dashboard-like appearance. I'm using radio buttons for selecting the year. Sadly in one of my datasets the attribute year is another attribute, even if contains exactly the same values. How can I solve the problem of matching attributes basing on their values in documents?...

Read external file match specific string in first column and return respective string of second column in php

php,string,return,matching,vlookup
I have two text files, csvurl.txt and tickerMaster.txt tickerMaster.txt H0001 Remarks: No "H0003" in tickerMaster.txt and the number are not in sequence csvurl.txt H0001, URL1 H0003, URL3 I would like to read the entries in tickerMaster.txt one by one, say H0001, H0003... and createURL by matching the data in csvurl.txt....

Look up value, on another Excel sheet

excel,matching,vlookup
I have a small list of names with no emails on sheet one, and on another sheet (sheet 2) I have the master list of names with their emails in the adjacent column. I want to look up the email associated with the name from the master list (sheet 2),...

Java String pattern that takes only specific strings [closed]

java,regex,string,matching
Following is the bulk data I have to go through: String s = ")(*&^%$ HELLO $#)(*&^%..$ this Is the text $KJHGFIUYTRMNBVkjh$I need$gfd987654"; I need the text enclosed within $...$ symbols, i.e output would be: HELLO this Is the text I need Can anyone help me?...

consistent matched pairs in R

r,for-loop,matching
So using the Matching Package (Link to package here) We can work through a modified GenMatch example. library(Matching) data(lalonde) #introduce an id vaiable lalonde$ID <- 1:length(lalonde$age) X = cbind(lalonde$age, lalonde$educ, lalonde$black, lalonde$hisp, lalonde$married, lalonde$nodegr, lalonde$u74, lalonde$u75, lalonde$re75, lalonde$re74) BalanceMat <- cbind(lalonde$age, lalonde$educ, lalonde$black, lalonde$hisp, lalonde$married, lalonde$nodegr, lalonde$u74, lalonde$u75, lalonde$re75, lalonde$re74,...

data cleaning and matching names in r

r,matching,reshape,reshape2
df1 <- structure(list(Name1 = structure(c(1L, 2L, 2L, 2L, 2L, 2L, 3L, 4L, 4L, 4L, 5L, 5L, 6L, 6L, 6L, 6L, 7L, 7L, 8L, 8L, 8L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 11L, 12L, 12L, 13L, 14L, 14L, 14L, 15L, 15L, 16L, 16L, 17L, 17L, 17L, 18L, 19L, 19L,...

Implementation of Absolute Differences Stereo Matching Algorithm

matlab,matching,vision,correspondence
Good day! I am trying to learn how to manually implement stereo matching algorithms. I'm basically starting with the most basic of them all - Absolute Difference. I found some slides online that describe how to do it. Basically, from what I understand, I should calculate the difference between the...

Python: efficient way to match 2 different length arrays and find index in larger array

python,arrays,performance,numpy,matching
I have 2 arrays: x and bigx. They span the same range, but bigx has many more points. e.g. x = np.linspace(0,10,100) bigx = np.linspace(0,10,1000) I want to find the indices in bigx where x and bigx match to 2 significant figures. I need to do this extremely quickly as...

print hash keys and values if they are matched

perl,hash,matching,fuzzy-search
I am trying to match a hash to file. However, what I am searching for and the file are not an exact match due to punctuation and spaces. For example, I might have "JE Industries, Incorporated" in my hash and "JE Industries Incorporated" in my file. Those two will obviously...

Adding up score in matching game java script

javascript,css,function,matching
I am quite new to java script so please be patient with me:) So I am making a matching game in java script (matching animal prints with their names) and even if I click on the correct answer, a score is never added, therefore you always lose. How can I...

extract FASTA sequence using sequence ID [closed]

perl,design-patterns,matching
I have two files: File 1: 84C2_Locus_14_Transcript_1/3_Confidence_0.571_Length_1244 AAACTAGTCAATAGAGAAAATCCAAAGTGGATGAAATTGAAGTGATTGTATGGCACAAGT...so on >84C2_Locus_14_Transcript_2/3_Confidence_0.857_Length_1961 AAACTAGTCAATAGAGAAAATCCAAAGTGGATGAAATTGAAGTGATTGTATGGCACAAGT...so on >84C2|Locus_15_Transcript_1/9_Confidence_0.190_Length_757 ATTTGCTCGGAAAAACACTTCTCGTGGAACTTGTTAGCGCTGAGCTTGATCCCAAGACGA.....so on >84C2_Locus_15_Transcript_5/9_Confidence_0.333_Length_1841...

C++ error: no matching constructor for initialization of

c++,constructor,matching
Im practicing memberwise assignment in C++, where you can set the values of one object to another object of the same class. The idea of the program is to initialize a rectangle object with some values and create another rectangle object but assign the value of the first into the...