Similarity plugin with French Language - similarity

I'm using the Similarity plugin with org.apache.lucene.analysis.fr.FrenchAnalyzer and I got strange results when searching close terms for a word. Some of the candidate term representations are mutilated in a strange way like:
pieuvre -> pieuvr, mobile -> mobil, chouette -> chouet, pattes -> pate, mieux -> mieu and the 'central' word telephone -> telephon.
similarity with the term 'téléphone':
I join the tiny rdf example:
#prefix : <http://data.edf.fr/ontologies/ideeShaker#> .
#base <http://data.edf.fr/data/ideeShaker/>
#prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
#prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
#prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<1> a :Idee;
:content "Le téléphone à pieuvre n’est pas mobile.";
rdfs:label "Test1" .
<2> a :Idee;
:content "Un tien vaut mieux que 2 téléphones";
rdfs:label "Test2" .
<3> a :Idee;
:content "La pieuvre a huit pattes";
rdfs:label "Test3" .
<4> a :Idee;
:content "La pieuvre et mobile Dick";
rdfs:label "Test4" .
<5> a :Idee;
:content "Pieuvre possède un portable";
rdfs:label "Test5" .
<6> a :Idee;
:content "Le téléphone à pieuvre c’est nul";
rdfs:label "Test6" .
<7> a :Idee;
:content "Le téléphone mobile c’est chouette";
rdfs:label "Test7" .
<8> a :Idee;
:content "Une pieuvre est mobile";
rdfs:label "Test8" .
<9> a :Idee;
:content "Une pieuvre et un téléphone";
rdfs:label "Test9" .
<10> a :Idee;
:content "Telephone à la pieuvre";
rdfs:label "Test10" .
Do you think this problem is related to the Lucene analyzer ot to the GraphDB integration?

You could use following "create index parameter":
-trainingcycles <number_of_training_cycles>.
The following will clear most of the unwanted results.
Note that this parameter should be used during index creation.

Related

How to dereference an uploaded URI node in Fuseki2 linked data server?

I installed Fuseki2 and run it as a standalone server with default settings (http://localhost:3030/).
I created an in-memory dataset ('geography') by uploading a Turtle file with information like this, through the 'Manage datasets' console:
#prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
#prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
#prefix owl: <http://www.w3.org/2002/07/owl#> .
#prefix schema: <http://schema.org/> .
#prefix dcat: <http://www.w3.org/ns/dcat#> .
#prefix pd: <http://localhost:3030/geography/ontology/> .
pd:City
rdf:type owl:Class ;
rdfs:comment "Represents a City in the ontology" .
<http://localhost:3030/geography/City/>
a dcat:Dataset;
schema:name "City information";
schema:description "Dataset with all the country's cities' information from 2018." ;
<http://localhost:3030/geography/City/1100015>
a pd:City;
rdfs:label "Rome" ;
pd:isCapital "1"^^xsd:int .
Although I can get the values by SPARQL query (eg. PREFIX dcat: http://www.w3.org/ns/dcat# SELECT ?s WHERE {?s a dcat:Dataset.}), I cannot access this node's information (http://localhost:3030/geography/City/1100015), as I would, for example , like this: http://dbpedia.org/page/Rome.
Is there a way that I can configure Fuseki server to dereference the URI that I uploaded and return the information of the node?
Apparently the only way to make the imported URIs resolvable is by using a Linked Data Interface, such as Pubby (http://wifo5-03.informatik.uni-mannheim.de/pubby/) or LOD View (https://github.com/LodLive/LodView).
Once installed, you can point them to the Fuseki's SPARQL endpoint.
Example with LodView config file (config.ttl):
conf:IRInamespace <http://localhost:3030/geography/> ; # base namespace for URIs
conf:endpoint <http://localhost:3030/sparql>; # where to query
The, you can access http://localhost:8080/lodview/geography/City/1100015 through content negotiation.

SPARQL querying not possible

I installed Fuseki on my local Ubuntu. Accessible via http://localhost:3030. Added a dataset "fuwstats" and a named graph "fuwstats" and then I imported some triples (see code below).
When I want to run the standard SPARQL query, nothing is shown (0 results). Any idea what I'm doing wrong?
SPARQL Endpoint is: http://localhost:3030/fuwstats/query
Query is: SELECT * WHERE { ?s ?p ?o }
This is the RDF that I added to the dataset:
#prefix fuwarticle: <http://localhost/article/> .
#prefix dc: <http://purl.org/dc/elements/1.1/> .
#prefix dcterms: <http://purl.org/dc/terms/> .
#prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
fuwstats:1452406 dc:source fuwarticle:lonza-stellt-sich-neu-auf.
fuwstats:1452406 fuwstats:visit _:b.
_:b fuwstats:visitor "bbbbbbbbbb"^^xsd:int.
_:b dcterms:date "2019-02-25 10:37:10"^^dcterms:W3CDTF .
fuwstats:1452406 fuwstats:visit _:c.
_:c fuwstats:visitor "aaaaaaaaa"^^xsd:int.
_:c dcterms:date "2019-01-26 10:37:10"^^dcterms:W3CDTF .`

How to get the network properties in R [duplicate]

Does anyone know of an R function that is able to retrieve one's own IP address (of the PC you're working on)? It would be very helpful! Many thanks in advance.
You can issue a system() command to your operating system:
In Windows you can use ipconfig
In Linux, use ifconfig
For example, on Windows try calling system() with the argument intern=TRUE to return the results to R:
x <- system("ipconfig", intern=TRUE)
This returns:
x
[1] ""
[2] "Windows IP Configuration"
[3] ""
[4] ""
[5] "Wireless LAN adapter Wireless Network Connection:"
[6] ""
[7] " Connection-specific DNS Suffix . : tbglondon.local"
[8] " Link-local IPv6 Address . . . . . : fe80::c0cb:e470:91c7:abb9%14"
[9] " IPv4 Address. . . . . . . . . . . : 10.201.120.184"
[10] " Subnet Mask . . . . . . . . . . . : 255.255.255.0"
[11] " Default Gateway . . . . . . . . . : 10.201.120.253"
[12] ""
[13] "Ethernet adapter Local Area Connection:"
[14] ""
[15] " Connection-specific DNS Suffix . : tbglondon.local"
[16] " Link-local IPv6 Address . . . . . : fe80::9d9b:c44c:fd4d:1c77%11"
[17] " IPv4 Address. . . . . . . . . . . : 10.201.120.157"
[18] " Subnet Mask . . . . . . . . . . . : 255.255.255.0"
[19] " Default Gateway . . . . . . . . . : 10.201.120.253"
[20] ""
[21] "Tunnel adapter Local Area Connection* 13:"
[22] ""
[23] " Media State . . . . . . . . . . . : Media disconnected"
[24] " Connection-specific DNS Suffix . : "
[25] ""
[26] "Tunnel adapter isatap.tbglondon.local:"
[27] ""
[28] " Media State . . . . . . . . . . . : Media disconnected"
[29] " Connection-specific DNS Suffix . : tbglondon.local"
[30] ""
[31] "Tunnel adapter Teredo Tunneling Pseudo-Interface:"
[32] ""
[33] " Media State . . . . . . . . . . . : Media disconnected"
[34] " Connection-specific DNS Suffix . : "
Now you can use grep to find the lines with IPv4:
x[grep("IPv4", x)]
[1] " IPv4 Address. . . . . . . . . . . : 10.201.120.184"
[2] " IPv4 Address. . . . . . . . . . . : 10.201.120.157"
And to extract just the ip address:
z <- x[grep("IPv4", x)]
gsub(".*? ([[:digit:]])", "\\1", z)
"10.201.120.184" "10.201.120.157"
I recently created a minimal package using ipify.org to do this exact thing.
Usage is easy, you can install using devtools and github.
library(devtools)
install_github("gregce/ipify")
once installed, its as easy as loading the library and one function call...
library(ipify)
get_ip()
Though #andrie explained it in very layman language and i am sure it helped us a lot to understand the functionality of it.
So from there only sharing a one liner code without installing any other package.
gsub(".*? ([[:digit:]])", "\\1", system("ipconfig", intern=T)[grep("IPv4", system("ipconfig", intern = T))])
Hope this would be helpful!
This retrieves exactly what you want:
system('ipconfig getifaddr en0')
192.168.1.73

set_locale in wordpress - woocommerce - stripe

Hello
my locale setting work everywhere except in stripe geteway plugin ( have asked stripe and woocommerce support : no solution )
detail of the probleme/bug here
https://github.com/woocommerce/woocommerce-gateway-stripe/issues/701
new info for this
testing this morning with the hook "wc_stripe_localized_messages"
add_filter("wc_stripe_localized_messages", function($arr_def){
$lang = WPTBASE::$theme_var["lang"];
WPTBASE::init_lang( $lang ); // this init lang and local
$wp_locale = get_locale(); // wp locale val
print "<pre>";
print "theme locale = " . WPTBASE::$theme_var["local"] . "\n";
print "wp locale = " . $wp_locale . "\n";
print $lang . "\n";
print $arr_def["invalid_number"];
print "\n";
print __( 'The card number is not a valid credit card number.', 'woocommerce-gateway-stripe' );
print "</pre>";
return $arr_def;
});
this ouput at the top of the checkout page
https://www.support-rack.com/sr_2018/ca/eng/checkout/
this :
theme locale = en_CA
wp locale = en_CA
eng
Le numéro de la carte de paiement n’est pas un numéro de carte de paiement valide.
Le numéro de la carte de paiement n’est pas un numéro de carte de paiement valide.
the wordpress locale is en_CA
but the __() ouput is french ?
help !
Resolve !
Wordpress french locale file is 'fr_CA' / canada
the stripe french locale file is fr_FR / france
I'm using fr_CA .....
details / details / details
this was a friday exercice

Function for retrieving own ip address from within R?

Does anyone know of an R function that is able to retrieve one's own IP address (of the PC you're working on)? It would be very helpful! Many thanks in advance.
You can issue a system() command to your operating system:
In Windows you can use ipconfig
In Linux, use ifconfig
For example, on Windows try calling system() with the argument intern=TRUE to return the results to R:
x <- system("ipconfig", intern=TRUE)
This returns:
x
[1] ""
[2] "Windows IP Configuration"
[3] ""
[4] ""
[5] "Wireless LAN adapter Wireless Network Connection:"
[6] ""
[7] " Connection-specific DNS Suffix . : tbglondon.local"
[8] " Link-local IPv6 Address . . . . . : fe80::c0cb:e470:91c7:abb9%14"
[9] " IPv4 Address. . . . . . . . . . . : 10.201.120.184"
[10] " Subnet Mask . . . . . . . . . . . : 255.255.255.0"
[11] " Default Gateway . . . . . . . . . : 10.201.120.253"
[12] ""
[13] "Ethernet adapter Local Area Connection:"
[14] ""
[15] " Connection-specific DNS Suffix . : tbglondon.local"
[16] " Link-local IPv6 Address . . . . . : fe80::9d9b:c44c:fd4d:1c77%11"
[17] " IPv4 Address. . . . . . . . . . . : 10.201.120.157"
[18] " Subnet Mask . . . . . . . . . . . : 255.255.255.0"
[19] " Default Gateway . . . . . . . . . : 10.201.120.253"
[20] ""
[21] "Tunnel adapter Local Area Connection* 13:"
[22] ""
[23] " Media State . . . . . . . . . . . : Media disconnected"
[24] " Connection-specific DNS Suffix . : "
[25] ""
[26] "Tunnel adapter isatap.tbglondon.local:"
[27] ""
[28] " Media State . . . . . . . . . . . : Media disconnected"
[29] " Connection-specific DNS Suffix . : tbglondon.local"
[30] ""
[31] "Tunnel adapter Teredo Tunneling Pseudo-Interface:"
[32] ""
[33] " Media State . . . . . . . . . . . : Media disconnected"
[34] " Connection-specific DNS Suffix . : "
Now you can use grep to find the lines with IPv4:
x[grep("IPv4", x)]
[1] " IPv4 Address. . . . . . . . . . . : 10.201.120.184"
[2] " IPv4 Address. . . . . . . . . . . : 10.201.120.157"
And to extract just the ip address:
z <- x[grep("IPv4", x)]
gsub(".*? ([[:digit:]])", "\\1", z)
"10.201.120.184" "10.201.120.157"
I recently created a minimal package using ipify.org to do this exact thing.
Usage is easy, you can install using devtools and github.
library(devtools)
install_github("gregce/ipify")
once installed, its as easy as loading the library and one function call...
library(ipify)
get_ip()
Though #andrie explained it in very layman language and i am sure it helped us a lot to understand the functionality of it.
So from there only sharing a one liner code without installing any other package.
gsub(".*? ([[:digit:]])", "\\1", system("ipconfig", intern=T)[grep("IPv4", system("ipconfig", intern = T))])
Hope this would be helpful!
This retrieves exactly what you want:
system('ipconfig getifaddr en0')
192.168.1.73

Resources