Lilypond: how do I add a slur/tie mark in lyrics to indicate that the singer should not breathe at this point? - lilypond

In Lilypond I am trying to add a mark into the lyrics that looks like a tie or a slur, to indicate that the singer should not take a breath at that point in the music. I believe the technical term is a "lyric liaison" but I could be mistaken. Here's an example that I photographed:
In this example, the singer should not breathe in bar 2, indicated by a "slur" mark spanning from the end of the word "high" to the start of the word "in".
I found that you can use the "~" character to insert an elision into the lyrics, but this is primarily used to assign two words to the same note. I then tried to trick Lilypond into doing what I wanted by eliding the word "high" to a space, which is almost correct, but the alignment is off. The slur starts before the end of the word "high" and stops in the space between "high" and "in".
\relative {
\key bes \major
\time 2/2
bes'4 bes c8 bes a g | f2. f4 | g bes bes a | bes2 bes
}
\addlyrics {Ding dong! mer -- ri -- ly on high~ in heav'n the bells are ring -- ing:}
Putting the space and the tilde the other way around produces a similar effect: just as wrong but in the opposite direction.
What am I doing wrong?

Related

Brush down stroke Lilypond

I'm trying to write a guitar tablature in which there must be a brush down stroke, and I can't find the way to do this with Lilypond. Here is my chord:
\score {
\layout { }
<<
\new TabStaff {
<e a c'>
}
>>
}
Below is the result of that code. So I'd like to add an up arrow at the left of that chord.
Does anyone know how to do it?
I'm not sure exactly what symbol you want for a brush downstroke – but I am assuming it is just a low note to high note arpeggio. (The default direction for an arpeggio is low to high, so musically speaking the arrow is unnecessary.)
In LilyPond the way to mark an arpeggio is by placing the command \arpeggio directly after the chord.
To get arrows on the arpeggio symbols you need to write \arpeggioArrowUp (or \arpeggioArrowDown) beforehand. See 1.3.3 Expressive marks as lines - arpeggio.
Unfortunately, the normal TabStaff doesn't display a lot of normal musical notation, including the arpeggio symbols.
However if you use the command \tabFullNotation inside of the TabStaff, a hybrid of tab notation and regular staff notation is displayed.
NB This will also mean that time signature and note stems etc. will also be printed.
Putting all of this together you should get something like this:
\score {
<<
\new TabStaff {
\tabFullNotation
\arpeggioArrowUp
<e a c'> \arpeggio
}
>>
\layout { }
}

how to add break line in JSON data file

How do I add a break line between each 'step' in my JSON data file in visual studio code?
Below is an example image of how the text is displayed on chrome. below the image is the example code
"Method": [
" 1.Place all the ingredients in a bowl and add 250ml cold water. Mix together with a spoon until you have a spongy mixture, cover with cling film and leave at room temperature overnight",
" 2.Tip the dough onto a floured surface and gently shape into a round. Dust a piece of baking parchment heavily with flour and sit the dough on top. Cover with a tea towel and leave to prove for 1 hr until doubled in size",
" 3.Heat oven to 220C/200C fan/gas 7. Place a flat baking tray on the middle shelf of the oven. Dust the dough with flour and slash with a utility knife.",
" 4.Bake for 25-30 mins until the loaf sounds hollow when tapped on the bottom. Leave the bread to cool completely."
]
If is not related to a particular code, you can select a comma "," and use the shortcut
SHIFT+CTRL+L
to select all the commas. Press the "RIGHT ARROW" to move right after all the commas and lose the selection (to avoid the cancellation of them) and then press "Enter".

NLTK multiple grammar rules optional CFG

I'm playing with NLTK and I meet a problem with the grammar.
(I didn't find any topics about this problem)
For example with a grammar gram.cfg:
S -> NP VP
NP -> 'I'
VP -> V ADJ WHO
ADJ -> 'tall' | 'big' | 'white'
V -> 'am'
WHO -> 'Groot'
and the sentence
"I am tall Groot" it's worked.
I want to have a grammar like
VP -> V (ADJ)* WHO
to have the possibility to obtain sentences like:
"I am white big tall Groot"
"I am big Groot"
"I am tall white Groot"
Only with the same rule VP
How can I do to multiply possibilities with one grammar rule (as showed in example) ?
Is there a documentation about that ? (dynamic rules, about optional rules, undefined number of rules ...etc)
If it is possible for you to use a recursive grammar the following may work.
ADJ -> 'tall' | 'big' | 'white' | ADJ

How does the Logical Equivalence Distributive Law make sense?

I understand that a truth table can prove the Distributive Law as a Logical Equivalence:
p V (q ^ r) <=> (p V q) ^ (p V r)
However, this makes no intuitive sense to me. Here is the contradiction I see: if p and q are both true, then wouldn't that result in p ^ q? that can work with the expression on the right, but that doesn't seem to work with the expression on the left. As I see it (and there must be something wrong with how I see it), either only p is true, or only q and r are true, according to the left expression.
Is anyone able to explain to me how this makes sense?
Let me know if I need to clarify anything.
The left hand equation is saying that either p is true or q and r are true. It does not say either p and only p is true, or q and r are only true.
For your example, p^q=> p (it also implies q, and pvq), which makes both sides true.
For example, in English the first equation says that at least one of the following is true
Pablo can swim OR
Quincy and Reginald can swim
If all three of them are true the statement is also true.
The one on the right says both of the following are true
Pablo or Quincy can swim AND
Pablo or Reginald can swim
If we have Pablo and Quincy can swim (your example), then we see that both statements hold. Pablo can swim so the first expression works because of its first clause. For the second expression since Pablo can swim both of its parts are true so it also holds.
I suspect you are using a colloquial meaning of "or", in the sense of "one or the other, but not both." E.g., "Choose the red pen or the blue pen." The meaning of "or" in formal logic is "at least one is true." In your hypothetical, certainly p^q, but the the values of q & r are irrelevant when p.

How to search "tags" in MySQL?

If I have a table on my DB called product_tags with 2 fields: tag_id and tag_name
Here is the schema:
CREATE TABLE `product_tags` (
`tag_id` int(11) NOT NULL auto_increment,
`tag_name` varchar(255) NOT NULL,
PRIMARY KEY (`tag_id`),
UNIQUE KEY `tag_name` (`tag_name`)
) ENGINE=MyISAM AUTO_INCREMENT=84 DEFAULT CHARSET=utf8
Say here some tags in it:
yellow gold
yellow diamond
white gold
rose gold
band
diamond
blue diamond
pink diamond
black diamond
And I want to do a search on the string "yellow gold diamond band"
I only want to pull the following tags:
yellow gold
band
diamond
Because only those tags are exactly in the string. yellow and diamond are both in the string but not together so the yellow diamond tag should be ignored.
-Additionally if possible
If I did the search for "yellow gold blue diamond band"
I only want to pull the following tags:
yellow gold
band
blue diamond
the diamond tag would be ignored because the blue diamond tag would be the match.
How can I do this?
edit:
select
*
from
product_tags P
where
INSTR('yellow gold diamond band', P.tag_name) > 0
Intuitively you could build an algorithm that iterates over all of the possible word combinations formed by contiguous words within the search phrase, and then find which of those is in your tag table. For instance:
yellow gold blue diamond band
Your possible combinations of contiguous would be:
yellow
gold
blue
diamond
band
yellow gold
gold blue
blue diamond
diamond band
yellow gold blue
gold blue diamond
blue diamond band
yellow gold blue diamond
gold blue diamond band
yellow gold blue diamond band
From this entire list, the only terms that match your original list are:
diamond
yellow gold
blue diamond
band
from this list you could cull any items that repeat the same word, favoring the longer option over the shorter with the assumption that the longer option is more descriptive. Thus, after removing those terms you have:
yellow gold
blue diamond
band
This looks like the list you want. Now, this approach works but it will become painfully sluggish as the number of terms in a search phrase increases. For instance, just your 5 terms generated 15 potential tag searches. Imagine if you put in 10 words...
Therefore, my honest recommendation is that you use some sort of punctuation to separate tags within a search, thus making it easier to find tags by simply splitting the searh phrase by the punctuation and searching on those terms, like thus:
yellow gold, blue diamond, band
With a comma-delimited list, you now only have 3 search terms rather than 15, making it much easier to search your table of tags.
Try this:
FROM product_tags
WHERE `tag_name` REGEXP ? LIMIT
You could probably do something like:
WHERE #searchTerm LIKE CONCAT('%', tag_name, '%')
Not very efficient for lots of tags, but it would work in the simple cases given.
I cant think of any good way to do this in SQL directly.
However if i were to implement it in my application logic, this is what the pseudo logic would probably be like
1. Split the search string "yellow gold diamond band" using " " character. string[] search
2. Take the 1st value from the array i.e. yellow in this case.
3. Do a SELECT * FROM product_tags WHERE tag_name LIKE 'yellow%'
4. This will return "yellow gold" and "yellow diamond"
5. Loop through each of the results in 4
a. Split each of these results using " " string [] result
b. If the split array contains has count = 1, we found an exact match for "yellow". No need to search further
c. If the length of the array > 1, Match the search[1] with result[1] till either you have exhausted the split array and find a match or dont find one
d. If more than one match has been found, the longest match is considered
6. Go back to step 2 and repeat for the next string i.e search[1]