query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives sequencelengths 0 101 | negative_scores sequencelengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
If there are two or more words that are the same length, return the first word from the string with that length. Ignore punctuation and assume sen will not be empty. | def longest_word(sen)
tmp_arr = sen.split(" ")
tmp_longest = 0
tmp_arr.each do |i|
tmp_longest = i.size if i.size > tmp_longest
end
tmp_arr.select { |i| i.size == tmp_longest }.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def LongestWord(sen)\n str = sen.split(\" \")\n longest_word = str[0]\n str.each do |word|\n word.sub(/[\\w\\s]/, '')\n if longest_word.length < word.length\n longest_word = word\n end\n end\n longest_word\nend",
"def LongestWord(sen)\n\tarr = sen.gsub(/[^a-zA-Z]+/m, ' ').strip.split(\" \")\n\... | [
"0.781355",
"0.758387",
"0.74880713",
"0.74303347",
"0.73972505",
"0.7377614",
"0.7355616",
"0.7231046",
"0.7179081",
"0.7120521",
"0.70515186",
"0.7044977",
"0.7025602",
"0.7022134",
"0.7019273",
"0.6981005",
"0.6978153",
"0.69676393",
"0.69303095",
"0.6930229",
"0.6918541",... | 0.6989949 | 15 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.welcome_email.subject | def product_email(product, user)
@greeting = 'Hi'
@product = product
mail to: user.email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def set_EmailSubject(value)\n s... | [
"0.6765104",
"0.6726595",
"0.67247695",
"0.67163604",
"0.67111814",
"0.67100495",
"0.6694839",
"0.6693109",
"0.6671716",
"0.6627427",
"0.6599362",
"0.65409476",
"0.6539258",
"0.65040624",
"0.64823294",
"0.64546007",
"0.6429769",
"0.6403822",
"0.6354559",
"0.6319615",
"0.63196... | 0.0 | -1 |
a single dash before and after each odd digit. There is one exception: don't start or end the string with a dash. You may wish to use the `%` modulo operation; you can see if a number is even if it has zero remainder when divided by two. Difficulty: medium. | def dasherize_number(num)
str = ""
arr = num.to_s.split('')
i = 0
while i<arr.count
if is_odd?(arr[i].to_f)
if i>0 && !(str[-1]=='-')
str += '-'
end
str += arr[i]
if i<arr.count-1
str += '-'
end
else
str += arr[i]
end
i+=1
end
return str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dasherize_number(num)\n\n index = 0\n \n num_string = num.to_s\n new_string = ''\n \n while index < num_string.length\n # Simplify your checks for odd and evenness here. \n # You are checking for so many things which makes the code messy.\n # Just divide the number using modulo you don't need to chec... | [
"0.8318996",
"0.7968655",
"0.79432404",
"0.7927553",
"0.79227006",
"0.7920647",
"0.7899584",
"0.77757",
"0.7765964",
"0.7704206",
"0.77036357",
"0.76868725",
"0.7661751",
"0.76534855",
"0.7652473",
"0.7633463",
"0.7631875",
"0.7612631",
"0.7606616",
"0.7600646",
"0.7583064",
... | 0.78489393 | 7 |
Returns true if the user is logged in, false otherwise. | def logged_in?
!curr_worker_id.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n user._logged_in?\n end",
"def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n r... | [
"0.9082417",
"0.8764097",
"0.87552106",
"0.8718715",
"0.86894006",
"0.86498255",
"0.86469626",
"0.86372185",
"0.8631328",
"0.86285406",
"0.86285406",
"0.8582609",
"0.85669243",
"0.85613596",
"0.85613596",
"0.8551865",
"0.85491496",
"0.85443276",
"0.85409296",
"0.8539988",
"0.... | 0.0 | -1 |
Redirects to stored location (or to the default). | def redirect_back_or(default)
redirect_to(session[:forwarding_url] || default)
session.delete(:forwarding_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_to_stored(default='/')\n return_to = session[:return_to] || default\n session[:return_to] = nil\n redirect return_to\n end",
"def redirect_to_stored_location_or(default)\n redirect_to(session[:forward_url] || default)\n session.delete(:forward_url)\n end",
"def redirect_ba... | [
"0.7730111",
"0.7649159",
"0.704684",
"0.7029194",
"0.6981081",
"0.6871779",
"0.67809576",
"0.67569697",
"0.6699827",
"0.65908873",
"0.6580519",
"0.65731466",
"0.65681744",
"0.6567211",
"0.654002",
"0.653624",
"0.6530604",
"0.65075284",
"0.64961356",
"0.64893895",
"0.6443822"... | 0.0 | -1 |
Stores the URL trying to be accessed. | def store_location
session[:forwarding_url] = request.url if request.get?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_location\n session[:forwarding_url] = request.url if request.get?\n # Makes sure that the URL is saved only for a GET request because submitting\n # DELETE, PATCH or POST will raise errors when the URL is expecting\n # a GET request.\n end",
"def store_location\n # store last url as lon... | [
"0.6912814",
"0.6897356",
"0.688702",
"0.6786295",
"0.6786295",
"0.6786295",
"0.6786295",
"0.6786295",
"0.6786295",
"0.6694544",
"0.66805685",
"0.66383713",
"0.6634571",
"0.6630931",
"0.6593764",
"0.6593764",
"0.6593764",
"0.6593764",
"0.6593677",
"0.65701944",
"0.65585965",
... | 0.647905 | 55 |
Confirms a loggedin user. | def logged_in_user
unless logged_in?
store_location
flash[:danger] = "Please enter your worker ID to continue."
redirect_to start_url
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n ... | [
"0.70087826",
"0.6982988",
"0.6919373",
"0.688131",
"0.6845446",
"0.68326277",
"0.67944413",
"0.67929715",
"0.6642435",
"0.6624581",
"0.66114175",
"0.66022736",
"0.6589018",
"0.65539706",
"0.65349805",
"0.65303934",
"0.6512816",
"0.650312",
"0.64878744",
"0.6487622",
"0.64804... | 0.0 | -1 |
I worked on this challenge with: Jon Clayton. Your Solution Below | def leap_year? (year)
case
when year % 400 == 0
return true
when year % 100 == 0
return false
when year % 4 == 0
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution4(input)\n end",
"def challenge; end",
"def decodeHalfway(input)\n sum = 0\n\n # Only have to loop through half the array since the numbers are being compared halfway around\n # Multiply each matching character by 2 to compensate for not looping through its pair\n input.chars[0..input.length/2... | [
"0.6426526",
"0.6196587",
"0.6143841",
"0.60725206",
"0.60663986",
"0.60514444",
"0.6044827",
"0.60304916",
"0.60167587",
"0.59670925",
"0.59660167",
"0.5930118",
"0.5916622",
"0.5908013",
"0.5902738",
"0.5890668",
"0.5882447",
"0.5870266",
"0.5864797",
"0.586191",
"0.5860125... | 0.0 | -1 |
GET /property_between_floor_slaps GET /property_between_floor_slaps.json | def index
@property_between_floor_slaps = PropertyBetweenFloorSlap.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | ["def set_property_between_floor_slap\n @property_between_floor_slap = PropertyBetweenFloorSlap(...TRUNCATED) | ["0.69060063","0.61157036","0.5888169","0.5649257","0.5491359","0.5422482","0.5376796","0.5331189","(...TRUNCATED) | 0.78588855 | 0 |
GET /property_between_floor_slaps/1 GET /property_between_floor_slaps/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | ["def index\n @property_between_floor_slaps = PropertyBetweenFloorSlap.all\n end","def set_prope(...TRUNCATED) | ["0.7740396","0.69099206","0.60001385","0.59754264","0.5973053","0.54860026","0.54810286","0.5468160(...TRUNCATED) | 0.0 | -1 |
CoRNStack Ruby Dataset
The CoRNStack Dataset, accepted to ICLR 2025, is a large-scale high quality training dataset specifically for code retrieval across multiple
programming languages. This dataset comprises of <query, positive, negative> triplets used to train nomic-embed-code,
CodeRankEmbed, and CodeRankLLM.
CoRNStack Dataset Curation
Starting with the deduplicated Stackv2, we create text-code pairs from function docstrings and respective code. We filtered out low-quality pairs where the docstring wasn't English, too short, or that contained URLs, HTML tags, or invalid characters. We additionally kept docstrings with text lengths of 256 tokens or longer to help the model learn long-range dependencies.
After the initial filtering, we used dual-consistency filtering to remove potentially noisy examples. We embed each docstring and code pair and compute the similarity between each docstring and every code example. We remove pairs from the dataset if the corresponding code example is not found in the top-2 most similar examples for a given docstring.
During training, we employ a novel curriculum-based hard negative mining strategy to ensure the model learns from challenging examples. We use a softmax-based sampling strategy to progressively sample hard negatives with increasing difficulty over time.
Join the Nomic Community
- Nomic Embed Ecosystem: https://www.nomic.ai/embed
- Website: https://nomic.ai
- Twitter: https://twitter.com/nomic_ai
- Discord: https://discord.gg/myY5YDR8z8
Citation
If you find the model, dataset, or training code useful, please cite our work:
@misc{suresh2025cornstackhighqualitycontrastivedata,
title={CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Reranking},
author={Tarun Suresh and Revanth Gangi Reddy and Yifei Xu and Zach Nussbaum and Andriy Mulyar and Brandon Duderstadt and Heng Ji},
year={2025},
eprint={2412.01007},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2412.01007},
}
- Downloads last month
- 338
