How to pass gnuradio-like tags in REDHAWK - redhawksdr

I'm trying to replicate gnuradio-like tags in REDHAWK, SRI looks a bit promising but I'm not sure that I can achieve my goal with that tool.
I'll give a basic example, let's say that I have a component that detects that a certain signal starts at a position. This component doesn't do anything else but this. I'd like to pass this information onto the second component so that It can start working from that position forward.
Is there any way to mark the specific position in the bulkio stream and pass it to the next component?
gnuradio has tags, that can pass any userdata between computational components, and it's precise to the bit.

Have you tried using keywords? They are part of the SRI data structures and are a list of key value pairs. The key is a user defined string and the value is any standard type (double, string, int, etc). Here is how front end devices use them to pass along filter bandwidth and frequency information: http://redhawksdr.github.io/Documentation/mainap6.html#x25-542000F.5.2

Related

How to use create a Custom class to format phone number in Google Speech-to-Text api?

I'm using Google Speech-to-Text api in order to transcribe phone calls in Hebrew.
Most of the phone calls contains customers that tells their phone-number, can I make some custom class in-order to format these numbers with the correct way?
Other example can be formatting an order-id which has a specific format.
I've read this article https://cloud.google.com/speech-to-text/docs/adaptation-model#custom_classes which tells that it can be a list of items...
What is the difference between class & phrase list?
PhraseSet indeed contain field phrases which is list of Phrase objects. The object contain two fields: value and boost (reference).
Now, in field value, is the phrase itself and is string. But instead of string value you can define and use CustomClass there, which in fact is a list of phrases (reference). So it works, when you want to add the same boost value to whole list of items. Example from the documentation mentioned by you is one of the best:
For example, you want to transcribe audio data that is likely to
include the name of any one of several hundred regional restaurants
Without custom class you would have to add all hundred names with seperate boost value. Instead you can create a list of values using CustomClass and assign one boost value for all of them. Additionally CustomClass can be managed independently to PhreaseSet.

finding organization and industry/sector from string in dbpedia

I am generating a short list of 10 to 20 strings which I want to lookup on dbpedia to see if they have an organization tag and if so return the industry/sector tag. I have been looking at the SPARQLwrapper queries on their website but am having trouble constructing one that returns organization and sector/industry for my string. Is there a way to do this?
If I use the code below I get a list of industry types I think rather than the industry of the company.
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("http://dbpedia.org/sparql")
sparql.setQuery("""
SELECT ?industry WHERE
{ <http://dbpedia.org/resource/IBM> a ?industry}
""")
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
Instead of looking at queries which are meant to help you understand the querying tool, you should start by looking at the data which is being queried. For instance, just click http://dbpedia.org/resource/IBM, and look at the properties (the left hand column) to see its rdf:type values (of which there are MANY)!
Note that IBM is not described as a ?industry. IBM is described as a <http://dbpedia.org/resource/Public_company> (among other things). On the other hand, IBM is also described as having three values for <http://dbpedia.org/ontology/industry> --
<http://dbpedia.org/resource/Cloud_computing>
<http://dbpedia.org/resource/Information_technology>
<http://dbpedia.org/resource/Cognitive_computing>
I don't know whether these are what you're actually looking for or not, but hopefully what I've done above will start you down the right path to whatever you do want to get out of DBpedia.

How to set a System Entity in a JSON response?

I have a composite entity working fine. But when I try to change its value by another composition in fulfillment, it's been interpreted as a string value:
const entity = {
"name":"projects/myproject/agent/sessions/" + sessionID +
"/entityTypes/lia_parametro1",
"entities":[{
"value":"#sys.email:email",
"synonyms":[
"#sys.email:email"
]
},
When I put this value directly in Dialogflow Console(#sys.email:email) it works fine, but when I try to do this dynamically as above, it understands "#sys.email:email" as a value, instead of a System Entity.
Is there a special way to declare System Entities in Json format?
Many thanks for any tip!
Diego Mesquita
I think you're getting confused about what the purpose of entities are.
Entities are used when extracting parameters - they're hints to Dialogflow to say "I'm trying to grab a piece of data from whatever the user has said, by the way the piece of data I want you to extract looks like this -> [the values of #sys.email]".
When something reaches your fulfillment code, that whole data extraction process has been done, and therefore entities become irrelevant. You can run whatever code you wish to extract data (for example a regex), then assign that as a parameter value to some output context.
To quote the documentation:
Each intent parameter has a type, called the entity type, which dictates exactly how data from an end-user expression is extracted.
I hope this helps - if not, can you give a little more info about your use-case?

Dynamically translating Pyramid's view arguments

Let's say that I have a view:
my_view(request: Request, uuid: UUID):
pass
I'd like to automatically translate all uuid objects to base64-based strings, so that the framework user doesn't need to manually call slug_to_uuid() and uuid_to_slug. This would apply to all views and is based on Python 3 argument signature type hinting (if it hints it's UUID object then you want to translate it to a string and back).
route_url('viewname', uuid=my_uuid) would encode UUID arguments as base64 string
Routing machinery would read Python 3 signature of a view function and translate string back to UUID object before calling the view
What hooks and approaches I can take this in Pyramid?
Hooks to route_url
Hooks in router to translate incoming view arguments using custom predicates, tweens, etc.
You're asking about 2 workflows. 1) translate incoming data. 2) translate outgoing data in urls.
In Pyramid the translation of incoming data should be done by decorators, view mappers or possibly predicates. You'll have to decide which fits your use-case best. Tweens don't really make sense because they happen prior to creation of the matchdict.
As far as url generation, the only hook available for route_url is a pregenerator on the route which can take the kwargs and translate them.
Use functools.singledispatch? https://docs.python.org/3/library/functools.html#functools.singledispatch

Attaching arbitrary data to objects in D3.js

This relates mostly with what a "best practice" would be with D3.js. I want to attach arbitrary information to different svg elements that I have on a page, after they are created. In D3, it looks like one generally generates svg elements from a dataset. I want to attach data to these svg elements at any time, without adding their HTML attributes.
Is there a good way of doing this? Do I need to use an auxillary array/object or is there a way to apply data to the elements themselves?
You would use the datum method if you want to attach arbitrary data:
D3.select('#mynodeId').datum( mydata );
And then later you could access the value again:
var mydata = D3.select('#mynodeId').datum();
Internally, D3 is going to use the __data__ property of the node, just like it does when the nodes were created from a data set via the selectAll, enter, append sequence.
Note that if you already have a reference to a DOM node you can pass it as the parameter to D3.select rather than making it re-look-up based on selector syntax:
D3.select( anExistingDOMNodeReference ).datum( mydata );
From the API doc:
d3.select(node): Selects the specified node. This is useful if you already have a reference to a node, such as d3.select(this) within an event listener, or a global such as document.body.

Resources