Avatar
Rif'at Ahdi R
2b67e480b7f99d2835684a8f7276d86edbe8e318ea55cf77ccfd559c5f24f645
Special family-friendly relay with filter settings (Language, Safe For Work, Hate speech, Sentiment, Topic, etc) for Global Feed: https://github.com/atrifat/nostr-filter-relay/blob/main/USAGE.md wss://nfrelay.app Indonesian. Learning and interested in PHP, JS, Go, DevOps, Android, and Machine Learning

I've done this a lot. nosdump is really useful, thank you Takumi-san 😊

You are welcome. Hopefully it is correct, you can always ask Vitor to get more explanation or confirmation 😅

"Gangan waluh" or can be roughly translated into "Pumpkin soup". It is local cullinary (Banjarese) in my hometown. Not sure if there are people who write the recipe in English 😅

Small VPS rent cost usually around 2.5-5 dollar depend on server providers

"You were downloading or running unhosted LLM, didn't you?" 😅

Yes, it is not baked directly in client otherwise it might drain quite a lot battery. Running additional app in server is more reasonable choice. I have already said that in previous reply "... client developer(s) choose to monitor relay data on their own as solution by running custom software in server to support their client software." push.amethyst.social use firebase token to send push notifications and will wake up/run Amethyst to show notifications.

Amethyst only show Zap (9735), DM (4) and Gift-wrapped DM (1059) notifications if i'm not mistaken.

Server code for notifications:

https://github.com/vitorpamplona/amethyst-push-notif-server/blob/main/index.mjs

I think you can easily look in RegisterAccountd.kt so i don't mention that 😄

https://github.com/vitorpamplona/amethyst/blob/main/app/src/main/java/com/vitorpamplona/amethyst/service/notifications/RegisterAccounts.kt

Look at lines 81, Vitor post Firebase token to his server to make push notification feature works. push.amethyst.social handle any notifications for Amethyst

https://push.amethyst.social/register

Yes, they could but they don't have any obligation to do so since it is not "standard features" defined by any NIPs. Start with NIPs and convince (make issue, pull request, or bounties) relay developers (many implementation) to do that is the way. Since it is hard thus client developer(s) choose to monitor relay data on their own as solution by running custom software in server to support their client software.

AFAIK, Amethyst do that https://github.com/vitorpamplona/amethyst/blob/main/app/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationUtils.kt . Other client like ZBD might do that. Not sure with other clients.

Mayoritas klien nostr bermadzhab antarmuka twitter 😅

And need to consider mentions. Even one or two mentions already use a lot of characters nostr : npubblablablablablablablabla 😅

I knew this is anecdotal (have seen "some" people like that) partly true for "some" but to make it as general statement "poor people (many/majority) are actually more greedy and arrogant than rich people (many/majority)", are there some statistical research to backup that? 😅

> Why do not relays could offer that service?

It is because current relay softwares like strfry, nostream, nostr-rs-relay and other relay softwares didn't have those features yet. It need some standard (NIPs) at first before relay developers make those custom features.

Therefore clients developers make workaround by monitoring relay with additional app outside their Nostr clients. Relay operators usually just run relay software without modifying any relay softwares code (not all relay operators are developers and they didn't have obligations to) 😅

It is an automated bot from certain paid relay which send invoice to invite new membership. It happens usually when we use Blastr relay wss://nostr.mutinywallet.com . Blastr broadcast events to all active relays including from those bot. 😅

There is an update for nostr-filter-relay documentation and explanation on "how it works".

What do you think? Is it clear explanation or still vague?

https://github.com/atrifat/nostr-filter-relay#how-it-works

What is your preferred #nostr web client that can show single relay data without login?

My favorites are Coracle, Nostrudel, Nostrrr, and Njump. Thanks to

nostr:npub1jlrs53pkdfjnts29kveljul2sm0actt6n8dxrrzqcersttvcuv3qdjynqn nostr:npub1ye5ptcxfyyxl5vjvdjar2ua3f0hynkjzpx552mu5snj3qmx5pzjscpknpr nostr:npub107jk7htfv243u0x5ynn43scq9wrxtaasmrwwa8lfu2ydwag6cx2quqncxg nostr:npub10000003zmk89narqpczy4ff6rnuht2wu05na7kpnh3mak7z2tqzsv8vwqk

I like how Coracle can show single relay data without login, and it feels like surfing "global feed" for certain relay

https://coracle.social/relays/nostr-id-relay.hf.space

The only downside is it doesn't seems support url parameters yet.

Nostrudel on the other hand has already support url parameters

https://nostrudel.ninja/#/r/wss%3A%2F%2Fnostr-id-relay.hf.space%2F%3Flang%3Did%2Cja%2Cth%26lang_confidence%3D65

And if we like simplicity, nostrrr.com and njump.me are good choices because they only give text without rendering many graphics.

https://nostrrr.com/relay/nrelay1qpt8wumn8ghj7mn0wd68yttfvskhyetvv9uju6rx9eehqctrv5hn7ar00p5kx0twdun8gmmcd9347cm0denxjer9de3k20fhx5nxcctwvu7k2m3xd3skue6lvdhkuenfv3jkucm985mr2x0n5zc

https://njump.me/r/nostr-id-relay.hf.space

Are there any web clients beside 4 of them who can display single relay without login? What is your favorites?

#asknostr

PSA:

Public demo instance of nostr-filter-relay wss://nostr-id-relay.hf.space will be restarted shortly for 5-15 minutes at November 22, 2023 04:00:00 UTC. Temporary downtime for new feature and other improvements.

Replying to Avatar Matt Lorentz

Very cool! I see the whole picture now. How did you get the content warning showing in Amethyst? Did that note just happen to already have a content warning on it? We are using a more robust ontology for content reports than what is defined in NIP-56. I’d be interested to hear your thoughts on it and whether or not it would be useful to you. https://github.com/rabble/nips/blob/724e05e762a634e501bdcf6cbefaa91f99b1903b/69.md

Here is what we publish when you report someone in Nos:

{

"content": "This content has been reported for Spam using NIP-69 vocabulary https://github.com/nostr-protocol/nips/pull/457",

"id": "03fdb75f9a8c927247cc4fc20abb419bb02932e615f056f67971e6cb8d073e09",

"tags": [

[

"L",

"MOD"

],

[

"l",

"MOD>SP",

"MOD"

],

[

"e",

"79123c0f6e54b330c8e1abba7ef5d6919ae493b072dcac7b603cada5f54bf4d3",

"spam"

]

],

"created_at": 1697565603,

"kind": 1984,

"sig": "5de629322692f102b85a8fc9921ce75b0f78fa3d4ff6f1d5cc69a777a75e6761b3448a689e1799d5d7e1f03aedad709910df03d2800e9801a8c9368841f46858",

"pubkey": "b1e4418e15a3660b5fa29e15e9e543427f2b3969617136be76072c7d674779a2"

}

Thank you. I'm glad that it can be understood. I think i really need to improve documentation in Github to make it easier. 😅

> How did you get the content warning showing in Amethyst? Did that note just happen to already have a content warning on it?

Oh no, i was intentionally made that post marked by using NIP-36 directly on Amethyst. What i have test was how my nostr-filter-relay test relay (wss://nostr-id-test-relay.hf.space) will react if i posted that negative comment. It works correctly by excluding those event. It will be merged soon into main relay (wss://nostr-id-relay.hf.space).

> https://github.com/rabble/nips/blob/724e05e762a634e501bdcf6cbefaa91f99b1903b/69.md

It is nice NIPs proposal to have list of ontology for labelling. I'm confused a bit since this PR seems to be cancelled because NIP-32 has been merged and superseded it, right? Also what is the source or reference to determine those ontology structure (IH, IL, NA, NS, etc.)?

Actually, i have already made considerations to transform current data format (kind: 9978) into NIP-32 format https://github.com/atrifat/nostr-monitoring-tool/issues/1 . Maybe i will do that after finishing other planned features (sentiment analysis and topic classification).

Currently, this is data format used by nostr-filter-relay internally. Data in "content" field (JSON stringified) were used in nostr-filter to determine the filtering. I think i need to format this in more efficient structure into NIP-32 compatible format. 😅

Example of language classification data:

{

"content": "[{\"confidence\":82,\"language\":\"ja\"}]",

"created_at": 1700614355,

"id": "event_id",

"kind": 9978,

"pubkey": "pubkey_of_classifier_bot",

"sig": "signature",

"tags": [

[

"d",

"nostr-language-classification"

],

[

"t",

"nostr-language-classification"

],

[

"e",

"75316bf6db0c75f8e57d2f3a2044d6eadacac92bfda780c62a89d5c47725fbe1"

],

[

"p",

"34a85403b43ff13441c7d79c98ba0f036add04b084b24f91c10d643f6d3f3665"

]

]

}

Example of hate speech (toxic comment) classification data:

{

"content": "{\"identity_attack\":0.6200000047683716,\"insult\":0.4620000123977661,\"obscene\":0.010999999940395355,\"severe_toxicity\":0,\"sexual_explicit\":0.0020000000949949026,\"threat\":0.004999999888241291,\"toxicity\":0.8059999942779541}",

"created_at": 1700000000,

"id": "event_id",

"kind": 9978,

"pubkey": "pubkey_of_classifier_bot",

"sig": "signature",

"tags": [

[

"d",

"nostr-hate-speech-classification"

],

[

"t",

"nostr-hate-speech-classification"

],

[

"e",

"c86cf6f0f7a30adfbd231d0e6d7b48c6d8909dd06bbcde9dd62a05f5ced072b5"

],

[

"p",

"dc369036ad76c7fe51b381ace9569e7add87c03dc74d9ab73b7e3299c18fe1c2"

]

]

}

Example of SFW/NSFW classification data:

{

"id": "event_id",

"created_at": 1696817846,

"kind": 9978,

"pubkey": "pubkey_of_classifier_bot",

"sig": "signature",

"content": "[{\"id\":\"58bd02d8c46eaa6f1598d5eff7cb33c06ff57c4c9ad3dad32ae2b70d3258f661\",\"author\":\"5fd004926969381ac2bb3a32720036d9f9632d29fb22dc1bf5d8fb1c9e265798\",\"is_activitypub_user\":false,\"has_content_warning\":false,\"has_nsfw_hashtag\":false,\"probably_nsfw\":false,\"high_probably_nsfw\":false,\"responsible_nsfw\":true,\"data\":{\"hentai\":0.0000018745902252703672,\"neutral\":0.9998550415039062,\"pornography\":0.0000746770019759424,\"sexy\":0.00006828152254456654,\"predictedLabel\":\"neutral\"},\"url\":\"url\"}]",

"tags": [

[

"d",

"nostr-nsfw-classification"

],

[

"t",

"nostr-nsfw-classification"

],

[

"e",

"58bd02d8c46eaa6f1598d5eff7cb33c06ff57c4c9ad3dad32ae2b70d3258f661"

],

[

"p",

"5fd004926969381ac2bb3a32720036d9f9632d29fb22dc1bf5d8fb1c9e265798"

]

]

}

Thank you nostr:npub16zsllwrkrwt5emz2805vhjewj6nsjrw0ge0latyrn2jv5gxf5k0q5l92l7 for looking this.

>Is your relay adding content warning tags?

No it didn't. It will make new classification event tagging event id and pubkey of author (kind: 9978) with classification labels (Language, toxicity, etc). Actually, i want to change and migrate that into NIP-32 format instead of custom kind 9978 like now.

I think i really need to draw some flowchart later to explain but did not have time yet. I'm sorry hopefully this can explain a bit 😅

How it works:

1. nostr-filter-relay will run several softwares: atrifat/nostr-monitoring-tool, atrifat/nostr-filter, and hoytech/strfry relay in launch script at startup.

2. nostr-monitoring-tool is classification tool that fetch and subscribe notes (kind: 1) from various relays. It will process every notes (extraction of image url, text preprocessing) it seen and send it into external AI classification tool. Currently it will send processed notes content into NSFW Detector API instance (using atrifat/nsfw-detector-api), LibreTranslate instance, and Hate Speech Detector API instance (using atrifat/hate-speech-detector-api). All three API will give classification results (NSFW class, Language class, Toxic classification) that will be saved as custom kind 9978 in local strfry relay that has already been running. Data format shown in atrifat/nostr-monitoring-tool in github.

Basic Data flow:

source relays (notes) -> nostr-monitoring-tool (connect to external API for classification) -> local strfry

3. Now, using classification data (kind: 9978) saved in local strfry relay, atrifat/nostr-filter will act as proxy relay and intercept any REQ from nostr client and forward them into local strfry relay. Local strfry relay will respond as usual by giving events based on REQ back to nostr-filter. Before sending events back to nostr clients, nostr-filter will check events from strfry whether it has classification data (kind: 9978) or not. For example users set nostr-filter-relay parameters to only gives notes which has "English" language then nostr-filter will only gives those notes using classification data. Any non "English" notes will be skipped.

Basic Data flow:

nostr clients <-> nostr-filter (act like frontend proxy) <-> strfry

4. Nostr client will get filtered events (Real data from strfry are 2000 notes but filtered into 1500 "english" notes) and show that to users.

wss://nostr-id-relay.hf.space now has proper temporary icon 👀

If we want to use it for "global feed" then we can set it like this (Amethyst example):

New feature of nostr-filter-relay (hate speech/toxic comment detection) has been available in dev branch of code and in test-relay instance. It will be released soon after some testing.

If you want to see some toxic contents 😅:

wss://nostr-id-test-relay.hf.space/?toxic=yes&toxic_confidence=75

Test of nostr-filter-relay new feature in dev branch.

The following comment reply below will have inappropriate comment, hidden with NIP-36. The comment(s) are some toxic comment, insult, or hate speech. I'm sorry, this is only test for nostr-filter-relay new features 🙏

I was really afraid in the morning whether my laptop components were melted or not 😅

I have once run visual object tracking code overnight using GPU in laptop. Makes my laptop achieve 87° C 😅

Replying to Avatar elsat

nostr:npub19dn7fq9hlxwjsdtgf28hyakcdmd73cccaf2u7a7vl42echey7ezs2hwja7

has the following relay in his profile. I havent dug into the effectiveness or how it works.

Yes, nostr:npub1zafcms4xya5ap9zr7xxr0jlrtrattwlesytn2s42030lzu0dwlzqpd26k5

nostr-filter-relay is configurable relay with several parameters. If you are familiar with filter.nostr.wine then you might easily understand how nostr-filter-relay work.

There are many examples (with different parameters relay) documented in USAGE https://github.com/atrifat/nostr-filter-relay/blob/main/USAGE.md

In nostr:npub12z8jsett3k6rv9fa2guau5p540qr2xuvjzkr8e432mglafjt99sqkw9zmx case, it can support her works actually as shown in illustration example:

"I want to make a specialized Nostr client for non sfw content creator (pornhubstr). I don't need any sfw/regular content"

wss://nostr-id-relay.hf.space/?content=nsfw

And vice versa:

"My Nostr client is s*cks. It doesn't have any settings or toggle button to filter Non SFW or sensitive content"

wss://nostr-id-relay.hf.space/?content=sfw

Users can freely customize relay settings using different parameters based on their needs. Feel free to test them. 🙂

Fast and reliable even for the old phone. Since not all android users using (can afford) the latest android phone. 😅

Replying to Avatar Rif'at Ahdi R

Early working code (PoC) for Hate speech (Toxic content) detection

https://github.com/atrifat/hate-speech-detector-api

This API server will be included as part of dependency for nostr-filter-relay.

#machinelearning #deeplearning

Update:

A public demo instance is available on HuggingFace Space - https://atrifat-hate-speech-detector-api-demo.hf.space. There is no guarantee for the uptime, but feel free to test this API server.

There is no Graphical UI (yet), so we can test it using tools like Postman, Reqbin, or Curl:

curl https://atrifat-hate-speech-detector-api-demo.hf.space/predict --header "Content-Type: application/json" --request POST --data '{"api_key":"", "q":"good morning"}'

Reqbin test tool: https://reqbin.com

nostr:nevent1qqsfk3xg82zpugnr25wp6punjvggltz64twuu8hypfa6cxd74zrsz9gpr4mhxue69uhkummnw3ez66ty94ex2mrp0yhxse3wwdcxzcm9qgszkelyszmln8fgx45y4rmjwmvxaklguvvw54w0wlx064vutuj0v3grqsqqqqqpaj4a4p